Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
There are a lot of objects involved in the commanding process, but there are only three steps to the process. You can perform the steps in any order.
A SET THE COMMAND PROPERTY ON THE SOURCE
The ICommandSource interface exposes three properties: Command, CommandParameter and CommandTarget; any widget that can act as a control source will expose these as simple properties (they’re actually dependency properties) that can be set in XAML or code:
In most situations that’s all you’ll need to do, but you can also set the CommandParameter and CommandTarget properties if you need to. The syntax is identical.
B WRITE THE HANDLERS
You’ll need two. The handler for the CanExecute event needs to match the signature for the CanExecuteRoutedEventHandler, which is: