private static void OnRichCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var button = d as RepeatButtonRichCommand; if (button == null) { return; } var command = e.NewValue as RichDelegateCommand <object>; if (command == null) { return; } ButtonRichCommand.ConfigureButtonFromCommand(button, command, button.ShowTextLabel); }
private static void OnRichCommandActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var button = d as TwoStateToggleButtonRichCommand; if (button == null) { return; } var choice = (Boolean)e.NewValue; RichDelegateCommand <object> command = button.RichCommandOne; if (command.KeyGesture == null && button.RichCommandTwo.KeyGesture != null) { command.KeyGestureText = button.RichCommandTwo.KeyGestureText; } if (button.InputBindingManager != null && command.KeyGesture != null && command.KeyGesture.Equals(button.RichCommandTwo.KeyGesture)) { button.InputBindingManager.RemoveInputBinding(button.RichCommandTwo.KeyBinding); button.InputBindingManager.AddInputBinding(command.KeyBinding); } if (!choice) { command = button.RichCommandTwo; if (command.KeyGesture == null && button.RichCommandOne.KeyGesture != null) { command.KeyGestureText = button.RichCommandOne.KeyGestureText; } if (button.InputBindingManager != null && command.KeyGesture != null && command.KeyGesture.Equals(button.RichCommandOne.KeyGesture)) { button.InputBindingManager.RemoveInputBinding(button.RichCommandOne.KeyBinding); button.InputBindingManager.AddInputBinding(command.KeyBinding); } } ButtonRichCommand.ConfigureButtonFromCommand(button, command, button.ShowTextLabel); }