Xml file in RadChar

2 posts, 0 answers
  1. jose
    jose avatar
    7 posts
    Member since:
    Sep 2010

    Posted 31 Jan 2011 Link to this post

    Hi... everyone.

    how to binding xml file in radChar???
  2. Missing user
    Missing user avatar

    Posted 03 Feb 2011 Link to this post

    Hello jose,

    You can read the XML document, retrieve the data and after that bind it to the chart.

    For example this is my xml file:

    <?xml version="1.0" encoding="utf-8" ?>
        <item Name="Peter" Age="26" />
        <item Name="Anna" Age="29" />

    and I am using Linq to XML to read the data:

    XDocument myXML = XDocument.Load("XMLFile1.xml");
    List<Person> personsList =
    (from person in myXML.Descendants("item")
    select new Person()
        Name = person.Attribute("Name").Value,
        Age = int.Parse(person.Attribute("Age").Value),

    Here you can find help and another examples about reading XML files:

    Here you can find examples about populating data in RadChart:

    In this example I'm using Manual Series Mapping and setting the data to the ItemSource:

    radChart.ItemsSource = personsList;

    <telerik:RadChart x:Name="radChart">
                    <telerik:ChartTitle Content="Age Statistic" />
            <telerik:SeriesMapping LegendLabel="Age">
                    <telerik:BarSeriesDefinition ShowItemToolTips="True" />
                    <telerik:ItemMapping DataPointMember="YValue"
                                    FieldName="Age" />
                    <telerik:ItemMapping DataPointMember="XCategory"
                                    FieldName="Name" />

    I hope this will help.

    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top