This question is locked. New answers and comments are not allowed.
Hi,
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}"
RadiusFactor="0.77">
<telerik:PieSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinition Margin="-8 0 0 0" >
<telerik:ChartSeriesLabelDefinition.Template>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding DataItem.StationGivenName}"
HorizontalAlignment="Center" Foreground="White"/>
<TextBlock Text="{Binding DataItem.CountOfBarcode}"
HorizontalAlignment="Center" Foreground="White"/>
</StackPanel>
</DataTemplate>
</telerik:ChartSeriesLabelDefinition.Template>
</telerik:ChartSeriesLabelDefinition>
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>?
Error:
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
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}"
RadiusFactor="0.77">
<telerik:PieSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinition Margin="-8 0 0 0" >
<telerik:ChartSeriesLabelDefinition.Template>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding DataItem.StationGivenName}"
HorizontalAlignment="Center" Foreground="White"/>
<TextBlock Text="{Binding DataItem.CountOfBarcode}"
HorizontalAlignment="Center" Foreground="White"/>
</StackPanel>
</DataTemplate>
</telerik:ChartSeriesLabelDefinition.Template>
</telerik:ChartSeriesLabelDefinition>
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>?
Error:
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