Class RelayCommand<T>
Implements generic version of command relaying by invoking defined action
Inheritance
System.Object
RelayCommand<T>
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: EmptyKeys.UserInterface.Input
Assembly: EmptyKeys.UserInterface.dll
Syntax
public class RelayCommand<T> : ICommand
Type Parameters
Name | Description |
---|---|
T |
Constructors
RelayCommand(Action<T>)
Initializes a new instance of the RelayCommand<T> class.
Declaration
public RelayCommand(Action<T> execute)
Parameters
Type | Name | Description |
---|---|---|
System.Action<T> | execute | The execute. |
RelayCommand(Action<T>, Predicate<T>)
Initializes a new instance of the RelayCommand<T> class.
Declaration
public RelayCommand(Action<T> execute, Predicate<T> canExecute)
Parameters
Type | Name | Description |
---|---|---|
System.Action<T> | execute | The execute. |
System.Predicate<T> | canExecute | The can execute. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | execute |
Methods
CanExecute(Object)
Defines the method that determines whether the command can execute in its current state.
Declaration
public bool CanExecute(object parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameter | Data used by the command. If the command does not require data to be passed, this object can be set to null. |
Returns
Type | Description |
---|---|
System.Boolean | true if this command can be executed; otherwise, false. |
Execute(Object)
Defines the method to be called when the command is invoked.
Declaration
public void Execute(object parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameter | Data used by the command. If the command does not require data to be passed, this object can be set to null. |