PieChart - getting error for dataitem property

2 posts, 0 answers
  1. joy
    joy avatar
    2 posts
    Member since:
    Aug 2010

    Posted 03 Dec 2012 Link to this post


    We are using Silverlight telerik RadPieChart.  It displays data collection from WCF RIA datasource.  We want to display custom fields (StationGivenName, CountOfBarcode) in labels like in your example (pie chart with countries=>  http://demos.telerik.com/silverlight/#ChartView/Selection)

    We have copied the code for <telerik:ChartSeriesLabelDefinition.Template>, our code is:

                    <telerik:RadPieChart x:Name="radChart1" Palette="Summer" Foreground="White" Grid.Row="1" Width="500" Height="300">

                        <telerik:PieSeries ValueBinding="CountOfBarcode" ItemsSource="{Binding Data, ElementName=chartDataSource}"
                                <telerik:ChartSeriesLabelDefinition Margin="-8 0 0 0" >
                                                <TextBlock Text="{Binding DataItem.StationGivenName}"
                                                       HorizontalAlignment="Center" Foreground="White"/>
                                                <TextBlock Text="{Binding DataItem.CountOfBarcode}"
                                                       HorizontalAlignment="Center" Foreground="White"/>

    Below is the error we are getting in the result. It means that DataContext of template is string "50%", and there is no member "DataItem".
    So how can we access data record and fields in    <telerik:ChartSeriesLabelDefinition.Template>?

    System.Windows.Data Error: BindingExpression path error: 'DataItem' property not found on '50 %' 'System.String' (HashCode=-1138646827). BindingExpression: Path='DataItem.StationGivenName' DataItem='50 %' (HashCode=-1138646827); target element is 'System.Windows.Controls.TextBlock' (Name=''); target property is 'Text' (type 'System.String')..

    Thank you for your help.

    Joy Gomez
  2. Petar Marchev
    Petar Marchev avatar
    1029 posts

    Posted 06 Dec 2012 Link to this post

    Hi Joy,

    Perhaps you are using an older version of our controls. Try it with assemblies from the official 2012 Q3 release or with the service pack and let us know how that goes.

    All the best,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top