Accessing LineSeries LabelDefinitions inside CategoricalSeriesDescriptor

3 posts, 1 answers
  1. Sivakumar
    Sivakumar avatar
    29 posts
    Member since:
    Dec 2015

    Posted 13 Mar 2016 Link to this post

    I am trying to provide custom label definition for dynamic line series.I could not set access LabelDefinitions for line series type  inside CategoricalSeriesDescriptor.Style . Can you please suggest how to do it ? 
        <telerik:ChartSeriesProvider Source="{Binding YourData}">
                <telerik:CategoricalSeriesDescriptor ItemsSourcePath="YourData" ValuePath="Value" CategoryPath="Category">
                        <Style TargetType="telerik:LineSeries">
                            <Setter Property="LabelDefinitions">
                                    <telerik:ChartSeriesLabelDefinition HorizontalAlignment="Center" VerticalAlignment="Center" >
                                                <TextBlock Foreground="DarkBlue" Text="{Binding DataItem.Value}" />
  2. Answer
    Martin Ivanov
    Martin Ivanov avatar
    1443 posts

    Posted 16 Mar 2016 Link to this post

    Hi Sivakumar,

    You cannot set LabelDefinitions collection through style because it is read-only. In order to add labels definitions you can use an attached property to set the definition and in the OnPropertyChangedCallback push it in the LabelDefinitions of the series. You can find this approach demonstrated in the Label Template Customization example.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Sivakumar
    Sivakumar avatar
    29 posts
    Member since:
    Dec 2015

    Posted 16 Mar 2016 in reply to Martin Ivanov Link to this post

    Thanks Martin...It is working..
Back to Top