XmlDataProvider in WPF (a simple demo)

In WPF XmlDataProviderEnables 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="https://blogs.msdn.com/ashish/rss.aspx">

            </XmlDataProvider>

         </Grid.Resources>

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

</Grid>