Share via


Command Constructors

Definition

Overloads

Command(Action)

Initializes a new instance of the Command class.

Command(Action<Object>)

Initializes a new instance of the Command class.

Command(Action, Func<Boolean>)

Initializes a new instance of the Command class.

Command(Action<Object>, Func<Object,Boolean>)

Initializes a new instance of the Command class.

Command(Action)

Initializes a new instance of the Command class.

public Command (Action execute);
new Xamarin.Forms.Command : Action -> Xamarin.Forms.Command

Parameters

execute
System.Action

An Action to execute when the Command is executed.

Applies to

Command(Action<Object>)

Initializes a new instance of the Command class.

public Command (Action<object> execute);
new Xamarin.Forms.Command : Action<obj> -> Xamarin.Forms.Command

Parameters

execute
System.Action<System.Object>

An Action<object> to execute when the Command is executed.

Remarks

The Action will be executed with a parameter.

Applies to

Command(Action, Func<Boolean>)

Initializes a new instance of the Command class.

public Command (Action execute, Func<bool> canExecute);
new Xamarin.Forms.Command : Action * Func<bool> -> Xamarin.Forms.Command

Parameters

execute
System.Action

An Action to execute when the Command is executed.

canExecute
System.Func<System.Boolean>

A System.Func`1 indicating if the Command can be executed.

Remarks

Whenever the value returned by canExecute has changed, a call to ChangeCanExecute() is required to trigger System.Windows.Input.ICommand.CanExecuteChanged.

Applies to

Command(Action<Object>, Func<Object,Boolean>)

Initializes a new instance of the Command class.

public Command (Action<object> execute, Func<object,bool> canExecute);
new Xamarin.Forms.Command : Action<obj> * Func<obj, bool> -> Xamarin.Forms.Command

Parameters

execute
System.Action<System.Object>

An Action<object> to execute when the Command is executed.

canExecute
System.Func<System.Object,System.Boolean>

A System.Func`2 indicating if the Command can be executed.

Remarks

Whenever the value returned by canExecute has changed, a call to ChangeCanExecute() is required to trigger System.Windows.Input.ICommand.CanExecuteChanged.

Applies to