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

返回

Boolean

如果可执行此命令,则为 true;否则为 falsetrue if this command can be executed; otherwise, false.

注解

通常,命令源 CanExecute 会在引发事件时调用方法 CanExecuteChangedTypically, a command source calls the CanExecute method when the CanExecuteChanged event is raised.

适用于

另请参阅