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)

Source:
Command.cs
Source:
Command.cs

Initializes a new instance of the Command class.

public:
 Command(Action ^ execute);
public Command (Action execute);
new Microsoft.Maui.Controls.Command : Action -> Microsoft.Maui.Controls.Command
Public Sub New (execute As Action)

Parameters

execute
Action

An Action to execute when the Command is executed.

Applies to

Command(Action<Object>)

Source:
Command.cs
Source:
Command.cs

Initializes a new instance of the Command class.

public:
 Command(Action<System::Object ^> ^ execute);
public Command (Action<object> execute);
new Microsoft.Maui.Controls.Command : Action<obj> -> Microsoft.Maui.Controls.Command
Public Sub New (execute As Action(Of Object))

Parameters

execute
Action<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>)

Source:
Command.cs
Source:
Command.cs

Initializes a new instance of the Command class.

public:
 Command(Action ^ execute, Func<bool> ^ canExecute);
public Command (Action execute, Func<bool> canExecute);
new Microsoft.Maui.Controls.Command : Action * Func<bool> -> Microsoft.Maui.Controls.Command
Public Sub New (execute As Action, canExecute As Func(Of Boolean))

Parameters

execute
Action

An Action to execute when the Command is executed.

canExecute
Func<Boolean>

A Func<TResult> indicating if the Command can be executed.

Remarks

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

Applies to

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

Source:
Command.cs
Source:
Command.cs

Initializes a new instance of the Command class.

public:
 Command(Action<System::Object ^> ^ execute, Func<System::Object ^, bool> ^ canExecute);
public Command (Action<object> execute, Func<object,bool> canExecute);
new Microsoft.Maui.Controls.Command : Action<obj> * Func<obj, bool> -> Microsoft.Maui.Controls.Command
Public Sub New (execute As Action(Of Object), canExecute As Func(Of Object, Boolean))

Parameters

execute
Action<Object>

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

canExecute
Func<Object,Boolean>

A Func<T,TResult> indicating if the Command can be executed.

Remarks

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

Applies to