This question is locked. New answers and comments are not allowed.
I am trying to detach my legend from the DefaultView. Following the post by Manol, I was able to get the desired behaviour, but only when defined in XAML. Using the code below, the legend is shown, but never populated.
This is the XAML, which actually works:
Any ideas?
var stackPanel =
new
StackPanel { OrientationOrientation = Orientation.Horizontal };
var legendName =
"MyLegend"
;
var chartLegend =
new
ChartLegend { Name = legendName };
var radChart =
new
RadChart();
radChart.DefaultView.ChartLegend.Visibility = Visibility.Collapsed;
radChart.DefaultView.ChartArea.LegendName = legendName;
stackPanel.Children.Add(radChart);
stackPanel.Children.Add(chartLegend);
This is the XAML, which actually works:
<
StackPanel
Name
=
"LayoutRoot"
Orientation
=
"Horizontal"
>
<
telerik:RadChart
Name
=
"rcChart"
>
<
telerik:RadChart.DefaultView
>
<
telerikCharting:ChartDefaultView
>
<
telerikCharting:ChartDefaultView.ChartLegend
>
<
telerikCharting:ChartLegend
Visibility
=
"Collapsed"
/>
</
telerikCharting:ChartDefaultView.ChartLegend
>
<
telerikCharting:ChartDefaultView.ChartArea
>
<
telerikCharting:ChartArea
LegendName
=
"MyLegend"
/>
</
telerikCharting:ChartDefaultView.ChartArea
>
</
telerikCharting:ChartDefaultView
>
</
telerik:RadChart.DefaultView
>
</
telerik:RadChart
>
<
telerikCharting:ChartLegend
Name
=
"MyLegend"
></
telerikCharting:ChartLegend
>
</
StackPanel
>
Any ideas?