private HookCommand ( ICommand command ) : void | ||
command | ICommand | |
Результат | void |
private void HookCommand(ICommand command)
{
_canExecuteChangedHandler = new EventHandler(OnCanExecuteChanged);
command.CanExecuteChanged += _canExecuteChangedHandler;
UpdateCanExecute();
}
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RibbonTextBox textBox = (RibbonTextBox)d; ICommand oldCommand = (ICommand)e.OldValue; ICommand newCommand = (ICommand)e.NewValue; if (oldCommand != null) { textBox.UnhookCommand(oldCommand); } if (newCommand != null) { textBox.HookCommand(newCommand); } RibbonHelper.OnCommandChanged(d, e); }