Share via


Command 建構函式

定義

多載

Command(Action)

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

Command(Action<Object>)

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

Command(Action, Func<Boolean>)

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

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

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

Command(Action)

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

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

參數

execute
System.Action

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

適用於

Command(Action<Object>)

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

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

參數

execute
System.Action<System.Object>

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

備註

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

適用於

Command(Action, Func<Boolean>)

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

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

參數

execute
System.Action

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

canExecute
System.Func<System.Boolean>

System.Func`1,指出是否可執行 Command。

備註

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

適用於

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

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

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

參數

execute
System.Action<System.Object>

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

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

System.Func`2,指出是否可執行 Command。

備註

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

適用於