ICommand.CanExecute(Object) 方法

定義

定義用來判斷命令是否能以其目前狀態執行的方法。Defines the method that determines whether the command can execute in its current state.

public:
 bool CanExecute(System::Object ^ parameter);
public bool CanExecute (object parameter);
abstract member CanExecute : obj -> bool
Public Function CanExecute (parameter As Object) As Boolean

參數

parameter
Object

命令所用的資料。Data used by the command. 如果命令不需要傳遞資料,則這個物件可設為 nullIf the command does not require data to be passed, this object can be set to null.

傳回

如果這個命令可執行,則為 true;否則為 falsetrue if this command can be executed; otherwise, false.

備註

通常,當引發 CanExecuteChanged 事件時,命令來源會呼叫 CanExecute 方法。Typically, a command source calls the CanExecute method when the CanExecuteChanged event is raised.

適用於

另請參閱