This is a migrated thread and some comments may be shown as answers.

RadGrid - XML Databinding?

3 Answers 109 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 27 Jun 2011, 12:14 PM
hi,

is it possible to get a complete example how to bind a xml file to a radgridview, including the xml file?
I can't find any example?

Please need help!

thank's a newbe!
Regards
Rene

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 30 Jun 2011, 12:56 PM
Hi Wigl Wagl,

 You may take a look at our online examples here (the Q2 2011 Beta version of the examples
is here). The mentioned example illustrates binding with XML Data Provider (as well as other data providers). You just need to view the code in Examples.xaml.cs and find the code under GetXmlData() method. 

private static object GetXmlData()
{
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<Products>
  <Product>
    <ID>1</ID>
    <Name>ASP.NET</Name>
    <Url>http://www.telerik.com/products/aspnet-ajax.aspx</Url>
  </Product>
  <Product>
    <ID>2</ID>
    <Name>WinForms</Name>
    <Url>http://www.telerik.com/products/winforms.aspx</Url>
  </Product>
</Products>
");
 
            XmlDataProvider provider = new XmlDataProvider();
            provider.IsAsynchronous = false;
            provider.Document = doc;
            provider.XPath = "Products/Product";
 
            return new ObservableCollection<XmlNode>((IEnumerable<XmlNode>)provider.Data);
        }

Then bind the returned data to the ItemsSource of the GridView.

In this help article you may find an additional info about loading data from XML.

Greetings,
Didie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
ITA
Top achievements
Rank 1
answered on 30 Jun 2011, 01:01 PM
Hi,

Thanks so much. But i have big Problems with your Links. I get just a black Screen an top left Text "RadGridView for WPF" and top
right a Search box.

King Regards
Rene
0
Milan
Telerik team
answered on 30 Jun 2011, 01:19 PM
Hi Wigl Wagl,

Here is  the correct link to the online example. 


Regards,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
ITA
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
ITA
Top achievements
Rank 1
Milan
Telerik team
Share this question
or