Hello,
I'm using Xamarin Forms and building MVVM based application. I want my ViewModel to take care of number and type of series in chart, so I am trying to bind Series Property:
Chart.SetBinding(SfChart.SeriesProperty, "DataCollection", BindingMode.OneWay);
where DataCollection is defined in ViewModel:
private ChartSeriesCollection _dataCollection = new ChartSeriesCollection();
public ChartSeriesCollection DataCollection
{
get { return _dataCollection; }
set
{
_dataCollection = value;
OnPropertyChanged();
}
}
But using binding this way gives me error:
System.NullReferenceException: Object reference not set to an instance of an object.
Other bindings work all right.
Why can't I bind SeriesProperty to ChartSeriesCollection?