To complete Will’s answer, here’s a “standard” implementation of the CanExecuteChanged
event :
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
(from Josh Smith’s RelayCommand
class)
By the way, you should probably consider using RelayCommand
or DelegateCommand
: you’ll quickly get tired of creating new command classes for each and every command of you ViewModels…