RadGrid - XML Databinding?

4 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 27 Jun 2011 Link to this post

    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
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 30 Jun 2011 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 30 Jun 2011 Link to this post

    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
  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 30 Jun 2011 Link to this post

    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
Back to Top