private void UpdateCanExecute() { if (this.Command != null) { this.CanExecute = CommandHelpers.CanExecuteCommandSource(this); } else { this.CanExecute = true; } }
private void UnhookCommand(ICommand command) { #if NET4 var handler = CommandHelpers.GetCanExecuteChangedHandler(this); if (handler != null) { command.CanExecuteChanged -= handler; CommandHelpers.SetCanExecuteChangedHandler(this, null); } #else CanExecuteChangedEventManager.RemoveHandler(command, new EventHandler <EventArgs>(this.OnCanExecuteChanged)); #endif this.UpdateCanExecute(); }
/// <summary> /// Executes the command which can be set by the user. /// </summary> public void RaiseCommand() { CommandHelpers.ExecuteCommandSource((ICommandSource)this); }