Glossary Item Box
This topic shows you how to declare an XmlDataProvider object in XAML. The XAML code for declaring the XmlDataProvider is written generically enough that it is control-independent, and no mention of a data-displaying control is made until the "Use the Data Provider" section of this topic. The XML file used in this topic is called Orders, and is available for you to download. The example XAML code assumes the XML file exists in a folder called "Data" in your project.
In XAML:
<Grid.Resources>
...
</Grid.Resources>In XAML:
..
<XmlDataProvider Source="../Data/Orders.xml"
x:Key="OrderData" XPath="/Orders" />
...
At this point you have everything in place to read in your Xml file. Now let's talk about how to display the file's contents inside one of the NetAdvantage for WPF data-driven controls. The control options include xamDataCarousel™, xamDataGrid™, xamDataPresenter™, and xamCarouselListBox™. With the exception of xamCarouselListBox, connecting the data set to the control is as simple as setting the control's DataSource property to a binding expression. For xamCarouselListBox, you need to set the ItemsSource property to the binding expression.
The following steps show you how to assign xamDataGrid's DataSource property to a binding expression that makes use of the XmlDataProvider declared in the procedure, "Set Up the Data Provider".
In XAML:
xmlns:igDP="http://infragistics.com/DataPresenter"
In XAML:
<igDP:XamDataGrid x:Name="XamDataGrid1"
DataSource="{Binding Source={StaticResource OrderData}, XPath=Order}"/>
