public void Execute(object?parameter) { if (CanExecute(parameter)) { ExecuteRequested?.Invoke(); } }
private void TbEditor_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { ExecuteRequested?.Invoke(this, new RoutedEventArgs()); e.Handled = true; } }
/// <summary> /// Defines the method to be called when the command is invoked. /// </summary> /// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param> public void Execute(object parameter) { var args = new ExecuteRequestedEventArgs { Parameter = parameter, CommandParent = TargetAction }; TargetAction(parameter); ExecuteRequested?.Invoke(parameter, args); }
protected virtual void OnExecuteRequested() { ExecuteRequested?.Invoke(); }
protected void ExecuteCommand() { ExecuteRequested?.Invoke(); }