Class RelayCommand<T>
Implementation of IRelay
Inherited Members
Namespace: Unity.AppUI.MVVM
Assembly: Unity.AppUI.MVVM.dll
Syntax
public class RelayCommand<T> : IRelayCommand<T>, IRelayCommand, ICommand
Type Parameters
Name | Description |
---|---|
T | The type of the CommandParameter. |
Constructors
RelayCommand(Action<T?>)
Initializes a new instance of the Relay
Declaration
public RelayCommand(Action<T?> execute)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | execute | The action to execute. |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the action is null. |
RelayCommand(Action<T?>, Predicate<T?>)
Initializes a new instance of the Relay
Declaration
public RelayCommand(Action<T?> execute, Predicate<T?> canExecute)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | execute | The action to execute. |
Predicate<T> | canExecute | The predicate executed to determine if the command can execute. |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the action or the predicate is null. |
Methods
CanExecute(object?)
Determines whether this Relay
Declaration
public bool CanExecute(object? parameter)
Parameters
Type | Name | Description |
---|---|---|
object | parameter | Data used by the command. |
Returns
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown if the |
CanExecute(T?)
Determines whether this Relay
Declaration
public bool CanExecute(T? parameter)
Parameters
Type | Name | Description |
---|---|---|
T | parameter | Data used by the command. |
Returns
Execute(object?)
Executes the Relay
Declaration
public void Execute(object? parameter)
Parameters
Type | Name | Description |
---|---|---|
object | parameter | Data used by the command. |
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown if the |
Execute(T?)
Executes the Relay
Declaration
public void Execute(T? parameter)
Parameters
Type | Name | Description |
---|---|---|
T | parameter | Data used by the command. |
NotifyCanExecuteChanged()
Notifies that the Can
Declaration
public void NotifyCanExecuteChanged()
Events
CanExecuteChanged
Event raised when Can
Declaration
public event EventHandler? CanExecuteChanged
Event Type
Type | Description |
---|---|
Event |