private static void UndoCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e) { //e.CanExecute = previousColor.HasValue; ColorUserControl colorUserControl = (ColorUserControl)sender; e.CanExecute = colorUserControl.previousColor.HasValue; }
private static void UndoCommand_Executed(object sender, ExecutedRoutedEventArgs e) { //this.Color = (Color) previousColor; ColorUserControl colorUserControl = (ColorUserControl)sender; Color currentColor = colorUserControl.Color; colorUserControl.Color = (Color)colorUserControl.previousColor; }