i am trying to display the content in the xml file that i have. this is the code that i have most of it from the documentation.
vb.net code
Imports Infragistics.Windows.DataPresenterClass Window1 Private xamDataGrid1 As XamDataGrid Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded xamDataGrid1 = New XamDataGrid() 'You can data bind your instance of xamDataGrid instead of using the built in sample data xamDataGrid1.BindToSampleData = False Me.layoutRoot.Children.Add(xamDataGrid1) End SubEnd Class
XAML Code
<Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" xmlns:igDP="http://infragistics.com/DataPresenter"> <Grid Name="layoutRoot"> <Grid.Resources> <XmlDataProvider x:Key="InventoryData" XPath="Inventory/Books"> </XmlDataProvider> </Grid.Resources> <igDP:XamDataGrid DataSource="{Binding Source={StaticResource InventoryData}, XPath=/Data/books.xml}" Height="11" HorizontalAlignment="Left" Margin="10,10,0,0" Name="XamDataGrid2" VerticalAlignment="Top" Width="1" /> </Grid></Window>
when i run the program nothing happens. where and how to i get the grid to display the content of the xml file
thank you
Hello,
You have to specify the name of the xml file with the data in the XmlDataProvider -- Source Property and then bind it to the DataSource Property of the XamDataGrid. Here is an article with a great example of this type of binding.
http://help.infragistics.com/Help/NetAdvantage/WPF/2008.2/CLR3.X/html/WPF_Binding_to_an_XML_File.html
Hope this helps you.
hey this link is dead. can you relink it?
to be more clear, the link to the xml article is dead.
thanks.
Here is a working link for the XML:
http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=xamDataPresenter_Bind_a_DataPresenter_Control_to_an_XmlDataProvider.html