Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
How do i display data from a xml file after binding
posted

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.DataPresenter

Class 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 Sub
End 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

Parents
  • 69686
    posted

     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. 

     

Reply Children