XmlDataProvider in WPF (a simple demo)


In WPF XmlDataProvider Enables declarative access and binding to XML data.


XmlDataProvider exposes the following ways to access XML data:


·         You can embed inline XML data using the XmlDataProvider class.


·         You can set this property to the Uri of an XML data file.


·         You can set the Document property to an XmlDocument.


XmlDataProvider performs a full refresh of all bindings on a XmlDocument.NodeChanged event. There are no optimizations for specific nodes.


The IsAsynchronous property of the XmlDataProvider class is set to true by default, which means that the XmlDataProvider retrieves data and produces the collection of XML nodes asynchronously by default.


 


Here is a simple example


 


<Grid>


      <Grid.Resources >


            <XmlDataProvider x:Key="AshishBlog"  XPath="rss/channel"     source="http://blogs.msdn.com/ashish/rss.aspx">


            </XmlDataProvider>


         </Grid.Resources>


 


<ListBox DataContext="{StaticResource AshishBlog}"  ItemsSource="{Binding XPath=item/title}"/>


</Grid>


 


Comments (2)

  1. Garry Trinder says:

    Thanks. This is a nice and simple example.  By the way, I needed to capitalize "source".

  2. Wriju Ghosh says:

    Going great. Post regularly

Skip to main content