private static void UnhookCommand(ButtonBase element, ICommand command) { CommandButtonBehavior behavior = (CommandButtonBehavior)element.GetValue(CommandButtonBehaviorProperty); behavior.Dettach(); element.ClearValue(CommandButtonBehaviorProperty); }
private static void HookCommand(ButtonBase element, ICommand command) { var behavior = new CommandButtonBehavior(element, command); behavior.Attach(); element.SetValue(CommandButtonBehaviorProperty, behavior); }
private static void HookCommand(ButtonBase element, ICommand command) { CommandButtonBehavior behavior = new CommandButtonBehavior(element, command); behavior.Attach(); element.SetValue(CommandButtonBehaviorProperty, behavior); }