Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2320
LegendItemTemplate in Code Behind
posted

Ok so I know how to assign a data template to the legend's items. In XAML it's as easy as putting the data template for LegendItemTemplate in xamChart.Resources and setting Legend.UseDataTemplate = true.

 

But how do I do this in code behind? I've tried the following:

xamChart.Resources.Add(typeof(LegendItemTemplate), this.TryFindResource(typeof(LegendItemTemplate)));

xamChart.Resources.Add("itemTemplate", this.TryFindResource("itemTemplate"));

 

The resource is added to xamChart.Resources no worries but XamChart doesn't seem to be picking it up at all. If no theme is specified, the chart just shows the object name and if a theme is specified, it just shows the theme's default data template.

Parents Reply Children
No Data