Intermediate abstract base class automatically requesting
CanExecute reevaluation when the CommandManager fires a
RequerySuggested event.
WPF Controls such as Buttons or MenuItems may only reevaluate
their Command's CanExecute state upon receiving a CanExecuteChanged
event. These Controls use the CanExecute result to determine their
own Enabled state. The WPF CommandManager uses the RequerySuggested
event to request that ICommands reevaluate their execution
conditions. Clients may force such a reevalation using
CommandManager.InvalidateRequerySuggested.
RoutedCommands listen to CommandManager.RequerySuggested by
default, but custom ICommands do not. This base class encapsulates
the behavior required to signal CanExecuteChanged when the
CommandManager raises a RequerySuggested event such that concrete
classes may inherit and reuse this behavior.
Public Member Functions
|
|
RequeryableCommandAdapter () |
|
Construct this ICommand and register a
CommandManager.RequerySuggested listener.
|
abstract
bool |
CanExecute (object parameter) |
|
Determine if the conditions under which this
ICommand can execute are valid.
|
abstract
void |
Execute (object parameter) |
|
Execute this ICommand's operation.
|
Protected Member Functions
|
virtual
void |
OnCanExecuteChanged (EventArgs e) |
|
Raises a CanExecuteChanged event.
|
Events
|
EventHandler |
CanExecuteChanged |
|
Signals that the conditions under which this
ICommand can execute have changed.
|