Trouble getting plot to refresh

Jul 11, 2013 at 8:43 AM
My xaml defining my plot.
    <Grid Style="{StaticResource ContentRoot}">
        <oxy:Plot x:Name="CloudLayerPlot" Model="{Binding CloudLayerPlotModel}" Width="600" Margin="0,0,0,0" />
Some of the code behind this XAML page.
    public PlotModel CloudLayerPlotModel { get; set; }

    public cloudDetectionGraph()
        DataContext = this;
I then call this code:
private void makeCloudLayerPlotModel()
            var end = new DateTime();
            end = DateTime.Now;

            var start = new DateTime();
            start = end.AddDays(-1);

            // Create data collection
            var data = new Collection<DateValue>();
            var date = start;

           // Other code here - removed as it's quite long

            CloudLayerPlotModel = plotModel1;
I've tried using RefreshPlot() in different places, ie. after when I call my function to make the plotmodel. I've also tried using invalidateplot() but no joy there either. Sure it's something i'm just overlooking!

When I call this function the first time, the plot is drawn correctly, subsequent calls don't though.
Jul 11, 2013 at 12:06 PM
Edited Jul 11, 2013 at 12:07 PM
I think it is just a binding problem, you should implement INotifyPropertyChanged for your main class:
YourClass :  INotifyPropertyChanged

          public event PropertyChangedEventHandler PropertyChanged;

        PlotModel cloudLayerPlotModel;
       public PlotModel CloudLayerPlotModel { 
             get{ return cloudPlotModel ; }
                    cloudPlotModel = value;

       protected void OnPropertyChanged(string name)
                 PropertyChangedEventHandler handler = PropertyChanged;
                 if (handler != null)
                     handler(this, new PropertyChangedEventArgs(name));
I hope this will resolve your problem
Jul 11, 2013 at 12:45 PM
Thank you so much!