Using XmlDataProvider Binding to GridDataControl Example

Have XML resource file  Lookup.xml
<LOOKUPCODES><LOOKUP_TYPE TYPE_NAME="Action"><LOOKUP NAME="232" DESCRIPTION="asdfasdfee" /><LOOKUP NAME="A" DESCRIPTION="Add" /></LOOKUP_TYPE></LOOKUPCODES>
 

<XmlDataProvider x:Key="LookupList" Source="Data\Lookup.xml" XPath="/LOOKUPCODES/LOOKUP_TYPE" x:Name="LookupList" />

Using Microsoft DATAGRID i can display the following by adding a Column to the Grid (Binding the column with XPath =@NAME )

NAME

232

A

 

So how do I do this with the SyncFusion GridDataControl

 

 


1 Reply

FP Farjana Parveen Ayubb Syncfusion Team August 18, 2014 01:04 PM UTC

Hi Rocky,

 

Thank you for contacting Syncfusion Support.

 

We analyzed your query. We regret to inform you that currently we don’t have a support for bind the XML file directly to GridDataControl as a ItemSource. You can achieve your requirement by using DataTable we read the XML file and save into DataTable and set the DataTable as a ItemSource to GridDataControl.

 

Please refer the below code snippet and sample in the following location:

 

Code Snippet:

public MainWindow()

        {

            InitializeComponent();

            DataSet ds = new DataSet();

            ds.ReadXml(@"..\..\Orders.xml");

            DataTable dt0 = new DataTable();

            dt0 = ds.Tables[0];

            this.datagrid.ItemsSource = ds.Tables[0];

        }

 

Regards,

Farjana Parveen A

 


Attachment: GDC_XML_5b230d80.zip

Loader.
Up arrow icon