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. 如果此命令不需要传递数据,则该对象可以设置为 null。If the command does not require data to be passed, this object can be set to null.
返回
如果可执行此命令,则为 true;否则为 false。true if this command can be executed; otherwise, false.
注解
通常,命令源 CanExecute 会在引发事件时调用方法 CanExecuteChanged 。Typically, a command source calls the CanExecute method when the CanExecuteChanged event is raised.