I need to be able to specify a dynamic set of BarSeries for a RadCartesianChart through XAML which is bound to a property in my viewmodel.
I tried creating a property which is of type List<CartesianSeries> and binding to that but it is not working.
The XAML I tried to use to bind to it is:
How is the BarSeries supposed to be bound to make it dynamic?
Thanks,
Tracy
I tried creating a property which is of type List<CartesianSeries> and binding to that but it is not working.
public List<
CartesianSeries
> BarSeriesList
{
get
{
List<
CartesianSeries
> barSeriesList = new List<
CartesianSeries
>();
foreach (ChartDataPointModel dataPoint in DataPoints)
{
BarSeries barSeries = new BarSeries();
barSeries.DataPoints.Add(new CategoricalDataPoint() { Value = dataPoint.Value, Label = dataPoint.Name, Category = dataPoint.Name });
barSeriesList.Add(barSeries);
}
return barSeriesList;
}
set
{
// do nothing
}
}
The XAML I tried to use to bind to it is:
<
chart:RadCartesianChart
Palette
=
"{Binding Palette}"
Height
=
"300"
Width
=
"500"
>
<
chart:RadCartesianChart.Series
>
<
chartView:BarSeries
ValueBinding
=
"Value"
CategoryBinding
=
"Name"
ItemsSource
=
"{Binding BarSeriesList}"
/>
</
chart:RadCartesianChart.Series
>
<
chart:RadCartesianChart.HorizontalAxis
>
<
chartView:CategoricalAxis
/>
</
chart:RadCartesianChart.HorizontalAxis
>
<
chart:RadCartesianChart.VerticalAxis
>
<
chartView:LinearAxis
LabelFormat
=
"0"
/>
</
chart:RadCartesianChart.VerticalAxis
>
<
chart:RadCartesianChart.Grid
>
<
chartView:CartesianChartGrid
MajorLinesVisibility
=
"Y"
/>
</
chart:RadCartesianChart.Grid
>
</
chart:RadCartesianChart
>
How is the BarSeries supposed to be bound to make it dynamic?
Thanks,
Tracy