15 readonly Action<object> _execute;
20 readonly Predicate<object> _canExecute;
26 public RelayCommand(Action<object> execute) : this(execute, null) { }
33 public RelayCommand(Action<object> execute, Predicate<object> canExecute)
36 throw new ArgumentNullException(
"execute");
39 _canExecute = canExecute;
50 return _canExecute == null ?
true : _canExecute(parameter);
58 add { CommandManager.RequerySuggested += value; }
59 remove { CommandManager.RequerySuggested -= value; }
66 public virtual void Execute(
object parameter)
RelayCommand(Action< object > execute)
Creates a new command that can always execute.
RelayCommand(Action< object > execute, Predicate< object > canExecute)
Creates a new command.
Command class for binding UI commands with view models.
EventHandler CanExecuteChanged
For connecting with Command Manager
virtual void Execute(object parameter)
Execute action
bool CanExecute(object parameter)
Method for getting if command is possible to run.