Binding ScatterSeries to ObservableCollection

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

tboloo wrote at 2013-03-18 15:46:

Apologies if this is trivial, but I have not found the solution so far.
Basically I am trying to bind ObservableCollection<MyType> to Scatter series, in hope that it would automatically reflect in points being added / removed to a plot. Now, I do not get any binding errors, but the points are not shown. Code is simple:
        private ObservableCollection<TestPointViewModel> testPoints = new ObservableCollection<TestPointViewModel>();
        private ReadOnlyObservableCollection<TestPointViewModel> readonlyTestPoints = null;
        public ReadOnlyObservableCollection<TestPointViewModel> TestPoints
                if (readonlyTestPoints == null)
                    readonlyTestPoints = new ReadOnlyObservableCollection<TestPointViewModel>(testPoints);
                return readonlyTestPoints;
in the ViewModel, and
                    <oxy:ScatterSeries Name="singleShotSeries" Title="Shot" MarkerType="Cross" DataFieldX="B" DataFieldY="G" ItemsSource="{Binding Admittance}"/>
in the View.
Am I doing something wrong, or binding to ObservableCollection is just a no-go?