This question is locked. New answers and comments are not allowed.
Hey Gang,
I'm attempting to bind a graph to an observable collection, and I'm getting
"Collection was modified; enumeration operation may not execute."
Ok - I'm 99% sure what is going on - the collection (which is of immutable objects BTW) gets items added by a time in a remote DLL - every 1/2 second or so
I'm guess that is the issue. Even if I could pause the remote operation, what is the preferred way to get the bound collection onto the graph's thread, as we never know when the collection will update
My current code - the basic chart is in the XAML (and named dataGraph) (oh, this is all UWP)
If I comment out the line for the ItemsSource, I'm all good
LineSeries lineSeries = new LineSeries();
lineSeries.Stroke = new SolidColorBrush(Colors.Orange);
lineSeries.StrokeThickness = 2;
lineSeries.VerticalAxis = new LinearAxis();
lineSeries.ItemsSource = theData; //this is the ObservableCollection<DataItem>
lineSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "TimeUTC" };
lineSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
dataGraph.HorizontalAxis = new DateTimeContinuousAxis() { LabelFormat = "HH:mm:ss" };
dataGraph.Series.Add(lineSeries);
I'm attempting to bind a graph to an observable collection, and I'm getting
"Collection was modified; enumeration operation may not execute."
Ok - I'm 99% sure what is going on - the collection (which is of immutable objects BTW) gets items added by a time in a remote DLL - every 1/2 second or so
I'm guess that is the issue. Even if I could pause the remote operation, what is the preferred way to get the bound collection onto the graph's thread, as we never know when the collection will update
My current code - the basic chart is in the XAML (and named dataGraph) (oh, this is all UWP)
If I comment out the line for the ItemsSource, I'm all good
LineSeries lineSeries = new LineSeries();
lineSeries.Stroke = new SolidColorBrush(Colors.Orange);
lineSeries.StrokeThickness = 2;
lineSeries.VerticalAxis = new LinearAxis();
lineSeries.ItemsSource = theData; //this is the ObservableCollection<DataItem>
lineSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "TimeUTC" };
lineSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
dataGraph.HorizontalAxis = new DateTimeContinuousAxis() { LabelFormat = "HH:mm:ss" };
dataGraph.Series.Add(lineSeries);