i am reading this tutorial
i don't understand what the below code is trying to do. 1st, the syntax reminds me properties, but with add/remove instead.
but what is CommandManager.RequerySuggested
?
It delegates the event subscription to the CommandManager.RequerySuggested event. This ensures that the WPF commanding infrastructure asks all RelayCommand objects if they can execute whenever it asks the built-in commands
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
also, save command is configured with lambdas. 1st, there are 2 param variables. will they conflict? i cannot just do something like RelayCommand(this.Save(), this.CanSave)
or is there no such syntax.
_saveCommand = new RelayCommand(param => this.Save(),
param => this.CanSave );