This is a migrated thread and some comments may be shown as answers.

LegendLabel Binding

2 Answers 63 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 05 Feb 2010, 09:27 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Giuseppe
Telerik team
answered on 10 Feb 2010, 07:57 AM
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.
0
Raj
Top achievements
Rank 1
answered on 10 Feb 2010, 02:09 PM
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.
Tags
Chart
Asked by
Raj
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Raj
Top achievements
Rank 1
Share this question
or