Class ActionCommand
A basic implementation of ICommand that wraps a method that takes no parameters or a method that takes one parameter.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.Expression.Interactivity.Core
Assembly: OpenSilver.Expression.Interactions.dll
Syntax
public sealed class ActionCommand : ICommand
Constructors
| Improve this Doc View SourceActionCommand(Action)
Initializes a new instance of the ActionCommand class.
Declaration
public ActionCommand(Action action)
Parameters
Type | Name | Description |
---|---|---|
System.Action | action | The action. |
Remarks
Use this constructor to provide an action that ignores the ICommand parameter.
ActionCommand(Action<Object>)
Initializes a new instance of the ActionCommand class.
Declaration
public ActionCommand(Action<object> objectAction)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Object> | objectAction | An action that takes an object parameter. |
Remarks
Use this constructor to provide an action that uses the object parameter passed by the Execute method.
Methods
| Improve this Doc View SourceExecute(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, then this object can be set to null. |
Explicit Interface Implementations
| Improve this Doc View SourceICommand.CanExecute(Object)
Defines the method that determines whether the command can execute in its current state.
Declaration
bool ICommand.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, then this object can be set to null. |
Returns
Type | Description |
---|---|
System.Boolean | Always returns true. |
ICommand.CanExecuteChanged
Occurs when changes occur that affect whether the command should execute. Will not be fired by ActionCommand.
Declaration
event EventHandler ICommand.CanExecuteChanged
Returns
Type | Description |
---|---|
System.EventHandler |