Command<T> Constructors

Definition

Overloads

Command<T>(Action<T>)

Initializes a new instance of the Command class.

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

Initializes a new instance of the Command class.

Command<T>(Action<T>)

Source:
Command.cs
Source:
Command.cs

Initializes a new instance of the Command class.

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

Parameters

execute
Action<T>

An Action to execute when the Command is executed.

Applies to

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

Source:
Command.cs
Source:
Command.cs

Initializes a new instance of the Command class.

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

Parameters

execute
Action<T>

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

canExecute
Func<T,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