public CanExecute ( object parameter ) : bool | ||
parameter | object | Data used by the command. /// If the command does not require data to be passed, /// this object can be set to null. |
return | bool |
public bool CanExecute(object parameter)
{
return (_executeAction != null && _canExecuteFunction != null && _canExecuteFunction());
}
public void No_Execution() { var executed = false; var command = new ActionCommand(() => executed = true, () => false, false); var canExecute = command.CanExecute(null); Assert.IsFalse(canExecute); command.Execute(null); Assert.IsFalse(executed); var obj = new Object(); canExecute = command.CanExecute(obj); Assert.IsFalse(canExecute); command.Execute(obj); Assert.IsFalse(executed); }