Xaml binding isnt working....

Oct 21, 2013 at 9:49 PM
Hi,
When i create graph in XAML, then binding to observable collection - it isn't working.
Why?
        <oxy:Plot Margin="10">
            <oxy:LineSeries x:Name="OxyPlotLine"
                            Width="Auto"
                            Height="Auto" ItemsSource="{Binding Mode=OneWay, Source={StaticResource ChartPoints}}" />
        </oxy:Plot>
            for (double i = 0; i <= stopValue; i++)
            {
                ii =+ i;
                CPColl.Add(new ChartPoint(i, CPColl.Count););             
            }
    class ChartPoint
    {
        private double _X;
        private double _Y;

        public ChartPoint(double X, double Y)
        {
            _X = X;
            _Y = Y;
        }

        public double X
        { get { return _X; } set { _X = value; } }

        public double Y
        { get { return _Y; } set { _Y = value; } }
    }
    class ChartPointsCollection: ObservableCollection<ChartPoint>
    {
        public ChartPointsCollection() : base()
        {  }
    }
Coordinator
Oct 22, 2013 at 9:55 PM
OxyPlot is not automatically refreshing the plot when the collection changes (this was a design choice and I know it is different from normal WPF control behaviour). You need to trig the Invalidate or Refresh method on the Plot control yourself. I'll consider again if the OxyPlot.Wpf.ItemsSeries should listen to collection changes (and item property changes...)
Oct 22, 2013 at 10:14 PM
Thank your for answer

Can your write a sample?
Oct 22, 2013 at 10:21 PM
Edited Oct 22, 2013 at 10:25 PM
Can i use observable collections?
Coordinator
Oct 23, 2013 at 6:59 AM
Yes, you can use any collection. See the examples in Source\Examples\Wpf