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

Add RadLegend dynamically

2 Answers 61 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Tam
Top achievements
Rank 1
Tam asked on 24 Jan 2019, 08:25 AM

I found this article, however in UWP there's no chart.LegendItems property. How can I do the same in UWP ?

https://www.telerik.com/forums/how-to-add-radlegend-in-code-behind

 

2 Answers, 1 is accepted

Sort by
0
Tam
Top achievements
Rank 1
answered on 25 Jan 2019, 03:31 AM
Does anyone know how to do it ?
0
Lance | Manager Technical Support
Telerik team
answered on 25 Jan 2019, 09:32 PM
Hello Tam,

The approach is different for UWP than it is for WPF.  Before going further, please take a moment to review the following help article and code example: Implement a Legend Control for a Cartesian Chart with Area Series to become familiar with the relationship between a Chart and the LegendControl.

You'll see that the property for the connection to the Chart is on the LegendControl itself, the LegendProvider property. Therefore, you can set that property in code behind like this:

// in this example, the reference to the chart is "chart"
var chart = new RadCartesianChart();
 
// Set the Legend using the LegendProvider property
var legend = new RadLegendControl();
legend.LegendProvider = chart;

If you have any trouble implementing this, please reply with all of your code so that we can investigate directly. 

Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Tam
Top achievements
Rank 1
Answers by
Tam
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Share this question
or