BarSeries series = new BarSeries();
series.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Name" };
series.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
series.ShowLabels = true;
series.ItemsSource = points;
My ItemsSource is just a list of my datapoint class.
How do I set the label for each point?
I can do it via xaml easy enough. How about code?
<telerik:CategoricalDataPoint Category="1" Value="0.05" Label="Some Point Specific Text">
I tried and failed with
<telerik:BarSeries.LabelDefinitions >
<telerik:ChartSeriesLabelDefinition >
<telerik:ChartSeriesLabelDefinition.Template>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding}"></TextBlock>
<TextBlock>
<TextBlock.Text>
<Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type telerik:BarSeries}}"
Path="DataPoints[0].DataItem.MyLabelProp"/>
</TextBlock.Text>
</TextBlock>
</StackPanel>
</DataTemplate>
</telerik:ChartSeriesLabelDefinition.Template>
</telerik:ChartSeriesLabelDefinition>
</telerik:BarSeries.LabelDefinitions>