Hi Markus,
Thanks for contacting Syncfusion Support.
We have analyzed your code snippet and tried to bind the ItemSource of a BarSeries to a collection of ViewModel. But we are unable to bind the ItemSource property as it is of type IEnumerable. So, we have achieved your requirement by creating a custom class inheriting BarSeries and creating a property of type ObservableCollection and binding that property to ViewModel collection. We have attached the sample for your reference, and it can be downloaded from the below link.
Code snippet [C#] - BarSeriesExt
public class BarseriesExt : BarSeries
{
private ObservableCollection<ChartData> data;
public ObservableCollection<ChartData> Data
{
get { return data; }
set
{
if (data != value)
{
data = value;
ItemsSource = data;
}
}
}
} |
Code snippet [C#] – MainActivity.cs
this.SetBinding(() => Vm.BarData, () => Series.Data); |
Please let us know if you have any concerns.
Regards,
Rachel.