共用方式為


Command 建構函式

定義

多載

Command(Action)

初始化 Command 類別的新執行個體。

Command(Action<Object>)

初始化 Command 類別的新執行個體。

Command(Action, Func<Boolean>)

初始化 Command 類別的新執行個體。

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

初始化 Command 類別的新執行個體。

Command(Action)

來源:
Command.cs
來源:
Command.cs

初始化 Command 類別的新執行個體。

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

參數

execute
Action

要在執行 Command 時執行的動作。

適用於

Command(Action<Object>)

來源:
Command.cs
來源:
Command.cs

初始化 Command 類別的新執行個體。

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

參數

execute
Action<Object>

要在執行 Command 時執行的 Action <物件>。

備註

動作將會使用 參數來執行。

適用於

Command(Action, Func<Boolean>)

來源:
Command.cs
來源:
Command.cs

初始化 Command 類別的新執行個體。

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

參數

execute
Action

要在執行 Command 時執行的動作。

canExecute
Func<Boolean>

Func<TResult>,指出是否可執行 Command。

備註

每當 canExecute 傳回的值已變更時,必須呼叫 ChangeCanExecute() 才能觸發 CanExecuteChanged

適用於

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

來源:
Command.cs
來源:
Command.cs

初始化 Command 類別的新執行個體。

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

參數

execute
Action<Object>

要在執行 Command 時執行的 Action <物件>。

canExecute
Func<Object,Boolean>

Func<T,TResult>,指出是否可執行 Command。

備註

每當 canExecute 傳回的值已變更時,必須呼叫 ChangeCanExecute() 才能觸發 CanExecuteChanged

適用於