/// <summary> /// Initializes a new instance of the <see cref="UndoCommandBinding<TController, TModel>"/> class. /// </summary> /// <param name="viewModel">The view model.</param> public UndoCommandBinding(ViewModel <TController, TModel> viewModel) { this.Command = ApplicationCommands.Undo; this.CanExecute += delegate(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = UndoCommand <TController, TModel> .CanExecute(viewModel, e.Parameter); }; this.Executed += delegate(object sender, ExecutedRoutedEventArgs e) { UndoCommand <TController, TModel> .Execute(viewModel, e.Parameter); }; }
internal static void Execute(ViewModel <TController, TModel> viewModel, object parameter) { UndoCommand <TController, TModel> .Undo(viewModel); }
internal static bool CanExecute(ViewModel <TController, TModel> viewModel, object parameter) { return(UndoCommand <TController, TModel> .CanUndo(viewModel)); }