xmldataprovider

How to load an xml string in the code behind to databound UI controls that bind to the XPath of the XML?

Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI. Has anyone found a way to load a dynamic xml string (for example load it from a file during runtim...

Detecting changes to the source data using the XmlDataProvider and a bound TextBox

I have a TreeView bound to an XmlDataProvider. The name of a node is reflected in the tree and the data of the node is in a TextBox. When you click on a tree item, it loads the data in the TextBox. What is the best way to determine when a user has changed the source data referenced by the XmlDataProvider. I would like to put an aster...

How do I create a new row in WPF DataGrid when it is bound to an XmlDataProvider?

I have a project with an XmlDataProvider bound to a WPF DataGrid control. I have the bindings on the DataGrid set up as follows: <dg:DataGrid ItemsSource="{Binding Source={StaticResource XmlData}, XPath=Root/People/Person}" AutoGenerateColumns="False"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header="ID" Bin...

WPF XmlDataProvider TreeView Error

I have a WPF TreeView control that is binding to an XMLDataProvider. The nodes are appearing fine within the Treeview control however the following error is appearing: System.Windows.Data Error: 43 : BindingExpression with XPath cannot bind to non-XML object.; XPath='Text/*' BindingExpression:Path=; DataItem='XmlDataCollec...

How to Bind an XmlDataProvider Class Property to a XAML TreeView

I would like to bind a TreeView control I have defined in XAML to a property in its code-behind class. I already read through a WPF Basic Data Binding FAQ, but the example in the comments at the very bottom of the page didn't work when I tried to use an XmlDataProvider as the binding source. How can I modify the following code so that t...

Using relative URI as XmlDataProvider's Source

Is it possible to use a relative URI when setting the Source property on an XmlDataProvider object in .NET? I get the following exception: IOException:System.IO.IOException: Cannot locate resource 'configuration.xml'. When I set the Source property using an absolute URI, everything works as expected: provider.Source = new Uri(@"C:\bi...

Are WPF binding properties Path and XPath mutually exclusive?

Suppose I have a UserControl whose DataContext is set to an object that has an XmlDataProvider property. I would like to bind to this property in my control's XAML, and specify some XPath. I tried this: <TreeView ItemsSource="{Binding Path=PropertyName, XPath=/items/item/*}"> At runtime I get the exception "BindingExpression with XPat...

Combobox Dataprovider - Only gets labelField from XML not the associated ID.

Hello guys. Back again this time working with data providers. Well i been doing a bit of training with Flex, and I've searched, and i managed to get a ComboBox being populated through XML data. Its works pretty well, he gets the LabelField for each item from XML, but the ID associated to each item he doesn't get then from the XML. Cod...

XmlDataProvider Refresh source WPF.

I have a WPF Grid <Window x:Class="LabsRSS.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Poperecinii Timur Lab" Height="404" Width="588"> <Grid x:Name="blah"> <Grid.Resources> <XmlDataProvider x:Key="flickrdata" Source="http://api.flic...

HierarchicalDataTemplate and HeaderedItemsControl with ControlTemplate fails to show nested data...

I can get this pattern to work with Menu and TreeView but I must be missing something when I make an attempt with HeaderedItemsControl: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Page.Resources> ...

How to bind XmlDataProvider.Source to MVVM property

I've got a treeview bound to an XmlDataProvider following this example. The app I am working on is following the MVVM pattern and the Xml is from a file that the user will open. When I try to bind the Source property of the XmlDataProvider like so <XmlDataProvider Source="{Binding Path=XmlFilePath}"/> I get a "Binding can only be app...

C# xmldataprovider insert node

Hello, I am trying to write an editor for an xml config file. I have the xml file bound to a listview and selecting an element and then clicking edit allows you to edit an element. When the user clicks save, a delegate is called which updates the element within the xml document. I have tried to do the updating in various ways including a...

how to change xmldataprovider source in wpf at runtime?

I made an application which draws a tree of organization based on values from an xml file. The xaml file goes like this : <Window.Resources> <!-- The Org Chart Data--> <XmlDataProvider x:Key="organization" Source="model.xml" /> <SolidColorBrush x:Key="ListBorder" Color="#FF7F9DB9"/> <!-- The Style for Nodes --> ...

WPF: Read XML Data Island from Code-Behind

Guys, I have a Window with an XmlDataProvider containing a data island. I want to read the XML from the code-behind. I have inspected all the properties of XmlDataProvider. I must be missing something. How can I do this? My Code-Behind: //how do I get the XML data island into a string? This does nothing... var s = sp.Resource...

WPF ListView loaded via binding with XmlDataProvider and I want to resize columns after the items are created.

Here is my XAML: <Window x:Class="Application.SeeProductVersions" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Application.ApplicationData" Title="Product Versions" Height="300" Width="640" Loaded="Window_Loaded...

XmlDataProvider authentication Http issue

Hi, I have an XMLDataProvider IsAsynchronous="True" x:Key="xmlData" Source="http://192.168.15.90/text.xml"/> The only problem is the Source requires authtication. I can get around this but using a HttpWebRequest in which I can pass in NetworkCredentials, but I was just wondering if there was a simpler way of p...

XmlDataProvider and XPath bindings don't allow default namespace of XML data?

I am struggling to work out how to use default namespaces with XmlDataProvider and XPath bindings. There's an ugly answer using local-name <Binding XPath="*[local-name()='Name']" /> but that is not acceptable to the client who wants this XAML to be highly maintainable. The fallback is to force them to use non-default namespaces in the ...

Binding to XMLDataProvider in Code Behind

Hello, i have a problem moving a XMLDataprovider Binding with XPath from Xaml to code behind. Labels.xml <?xml version="1.0" encoding="utf-8" ?> <Labels> <btnOne Label="Button1"/> <btnTwo Label="Button2"/> </Labels> MainWindow.xaml <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x...

set XmlDataProvider source without saving file

in my browser wpf application i use databinding to xml that comes from my database. to bind it the better way i use the XmlDataProvider. in the beginning i declare <Grid.DataContext> <XmlDataProvider x:Name="listdataxml" XPath="EssenceList/Essence" Source="model.xml"/> </Grid.DataContext> but later i need to point it to a new XDo...

How to reduce XmlDataProvider lag?

I have XmlDataProvider pointed to external content file as a staticresource. And then I have Combobox whose ItemsSource is bound a node from the xml. The first time I unroll combobox there is lag. Second time there is no lag. I'm thinking this is due to fact that contents are lazy loaded from disk. How do I reduce this lag? ...