Show / Hide Table of Contents

Class ActionCommand

A basic implementation of ICommand that wraps a method that takes no parameters or a method that takes one parameter.

Inheritance
System.Object
ActionCommand
Implements
System.Windows.Input.ICommand
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: Microsoft.Expression.Interactivity.Core
Assembly: OpenSilver.Expression.Interactions.dll
Syntax
public sealed class ActionCommand : ICommand

Constructors

| Improve this Doc View Source

ActionCommand(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.

| Improve this Doc View Source

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 Source

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, then this object can be set to null.

Explicit Interface Implementations

| Improve this Doc View Source

ICommand.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.

| Improve this Doc View Source

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

Implements

System.Windows.Input.ICommand
  • Improve this Doc
  • View Source