New to Telerik UI for WinFormsStart a free 30-day trial

Provides a simple ICommand implementation.

Definition

Namespace:Telerik.WinControls.RichTextEditor.UI.Commands

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class DelegateCommand : ICommand

Inheritance: objectDelegateCommand

Implements: ICommand

Constructors

Initializes a new instance of the DelegateCommand class.

C#
public DelegateCommand(Action<object> execute, Predicate<object> canExecute)
Parameters:executeAction<object>

The execute action.

canExecutePredicate<object>

The can execute predicate.

Initializes a new instance of the DelegateCommand class.

C#
public DelegateCommand(Action<object> execute)
Parameters:executeAction<object>

The execute action.

Methods

Defines the method that determines whether the command can execute in its current state.

C#
public bool CanExecute(object parameter)
Parameters:parameterobject

Data used by the command. If the command does not require data to be passed, this object can be set to null.

Returns:

bool

True if this command can be executed, otherwise - false.

Implements: ICommand.CanExecute(object)

Defines the method to be called when the command is invoked.

C#
public void Execute(object parameter)
Parameters:parameterobject

Data used by the command. If the command does not require data to be passed, this object can be set to null.

Implements: ICommand.Execute(object)

Raises the CanExecuteChanged event.

C#
public void InvalidateCanExecute()

Events

Occurs when changes occur that affect whether the command should execute.

C#
public event EventHandler CanExecuteChanged

Implements: ICommand.CanExecuteChanged