Class RelayCommand
Represents relay command.
public class RelayCommand : ICommand
- Inheritance
-
RelayCommand
- Implements
- Derived
- Inherited Members
Constructors
RelayCommand(Action<object>)
Initializes a new instance of the RelayCommand class.
public RelayCommand(Action<object> execute)
Parameters
execute
Action<object>Action to execute in the Execute(object) method.
RelayCommand(Action<object>, Predicate<object>)
Initializes a new instance of the RelayCommand class.
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
Parameters
execute
Action<object>Action to execute in the Execute(object) method.
canExecute
Predicate<object>Predicate that defines, whether the command can be executed.
Methods
CanExecute(object)
This method determines whether the command can execute in its current state.
public virtual bool CanExecute(object parameter)
Parameters
parameter
objectData 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.
Execute(object)
This method is called when the command is invoked.
public virtual void Execute(object parameter)
Parameters
parameter
objectData used by the command. If the command does not require data to be passed, this object can be set to null.
Events
CanExecuteChanged
Occurs when changes occur that affect whether or not the command should execute.
public event EventHandler CanExecuteChanged