LegendLabel Binding

3 posts, 1 answers
  1. Raj
    Raj avatar
    34 posts
    Member since:
    Aug 2009

    Posted 05 Feb 2010 Link to this post

    I would like to bind the LegendLabel to a property in my ViewModel, something like...

    <telerikCharting:SeriesMapping LegendLabel="{Binding ViewModelField}" >

    This does not seem to work. I've also tried binding to another element on the page which itself binds to the view model...

    <telerikCharting:SeriesMapping LegendLabel="{Binding Text, ElementName=SeriesALengendLabelText}" >
    ...
    ...
    <TextBlock x:Name="SeriesALengendLabelText" Text="{Binding ViewModelField}" Opacity="0"/>

    Any ideas on how I can accomplish this?
  2. Answer
    Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 10 Feb 2010 Link to this post

    Hello Raj,

    The SeriesMapping.LegendLabel property is not a dependency property so you cannot use a binding expression to assign its value. Note that this cannot be improved at the moment as in Silverlight the binding target can be a DependencyProperty of a FrameworkElement only and SeriesMapping is not a FrameworkElement (it has no visual presentation).


    Regards,
    Manuel
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Raj
    Raj avatar
    34 posts
    Member since:
    Aug 2009

    Posted 10 Feb 2010 Link to this post

    Thanks for the info. The reason I wanted this functionality was to support a variety of chart data within the same control. Depending on what data set I'm binding to the legend needed to change appropriately. I have found a bit of a workaround - I have defined different sets of series definitions for each chart and set the relevant legend as needed. Since the unused series has no data, the legend does not show up.
Back to Top