I am trying to manipulate the PlotModel via MVVM. I have created a list of SeriesVisibility
models that represent a Series (model, not WPF) with a
properties. As soon as the property has changed, I pass on the property to the series model:
private void OnIsVisibleChanged()
Series.IsVisible = IsVisible;
This does not update because the models do not implement INotifyPropertyChanged
. I wanted to work around this problem with this method in a service:
public void UpdateSeriesVisibility()
var plotModel = PlotModel;
if (plotModel == null)
var plotControl = plotModel.PlotControl as Plot;
if (plotControl != null)
foreach (var viewSeries in plotControl.Series)
viewSeries.Visibility = viewSeries.InternalSeries.IsVisible ? Visibility.Visible : Visibility.Hidden;
Unfortunately the plotControl.Series
is empty while PlotModel.Series
are not empty.
Next thing I was trying is to UpdateData or InvalidatePlot, but this does not cause a re-render of the plot:
- UpdateData(false and true)
- InvalidatePlot(false and true)
Nothing seems to redraw. Only when I resize the window it actually redraws (without the unselected series).
Can you give some hints on how I can re-render the plot?