Class
DelegateCommand

Provides a simple ICommand implementation.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.dll

Syntax:

cs-api-definition
public class DelegateCommand : ICommand

Inheritance: objectDelegateCommand

Implements: ICommand

Constructors

DelegateCommand(Action<object>)

Initializes a new instance of the DelegateCommand class.

Declaration

cs-api-definition
public DelegateCommand(Action<object> execute)

Parameters

execute

Action<object>

The execute action.

DelegateCommand(Action<object>, Predicate<object>)

Initializes a new instance of the DelegateCommand class.

Declaration

cs-api-definition
public DelegateCommand(Action<object> execute, Predicate<object> canExecute)

Parameters

execute

Action<object>

The execute action.

canExecute

Predicate<object>

The can execute predicate.

Methods

CanExecute(object)

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

Declaration

cs-api-definition
public bool CanExecute(object parameter)

Parameters

parameter

object

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)

Execute(object)

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

Declaration

cs-api-definition
public void Execute(object parameter)

Parameters

parameter

object

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)

InvalidateCanExecute()

Raises the CanExecuteChanged event.

Declaration

cs-api-definition
public void InvalidateCanExecute()

Events

CanExecuteChanged

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

Declaration

cs-api-definition
public event EventHandler CanExecuteChanged

Event Value

EventHandler

Implements ICommand.CanExecuteChanged