public ManipulateSeriesMvvmViewModel() { _renderableSeriesViewModels = new ObservableCollection <IRenderableSeriesViewModel>(); _addCommand = new ActionCommand(() => { RenderableSeriesViewModels.Add(ViewModelsFactory.New(SelectedSeriesType.Type, 0)); ZoomExtents(); ClearCommand.RaiseCanExecuteChanged(); }, () => SelectedSeriesType != null); _removeCommand = new ActionCommand(() => { RenderableSeriesViewModels.RemoveWhere(s => s.IsSelected); ClearCommand.RaiseCanExecuteChanged(); }, () => RenderableSeriesViewModels.Any(s => s.IsSelected)); _clearCommand = new ActionCommand(() => { RenderableSeriesViewModels.Clear(); ClearCommand.RaiseCanExecuteChanged(); }, () => RenderableSeriesViewModels.Count > 0); _selectionChangedCommand = new ActionCommand(() => { var rSeriesVm = RenderableSeriesViewModels.FirstOrDefault(s => s.IsSelected); if (rSeriesVm != null) { SelectedSeriesType = SeriesTypes.FirstOrDefault(x => x.Type == rSeriesVm.GetType()); } RemoveCommand.RaiseCanExecuteChanged(); }); var data = DataManager.Instance.GetSinewave(1.0, 0.5, 100, 5); var lineDataSeries = new XyDataSeries <double, double>(); lineDataSeries.Append(data.XData.Select(d => d * 5), data.YData); FillSeriesTypes(); SelectedSeriesType = SeriesTypes[3]; _addCommand.Execute(null); AddCommand.RaiseCanExecuteChanged(); RemoveCommand.RaiseCanExecuteChanged(); }