We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Using XmlDataProvider Binding to GridDataControl Example

Thread ID:

Created:

Updated:

Platform:

Replies:

117118 Aug 15,2014 05:10 PM Aug 18,2014 09:04 AM WPF 1
loading
Tags: GridDataControl
Rocky Wurden
Asked On August 15, 2014 05:10 PM

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

 

 


Farjana Parveen Ayubb [Syncfusion]
Replied On August 18, 2014 09:04 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;