Defines an object that knows how to invoke a command.
Assembly: PresentationCore (in PresentationCore.dll)
A command source will normally disable itself if the command it is associated with cannot execute on the current command target. For example, a MenuItem associated with the Paste command will gray itself out when the Paste command cannot execute on the current command target.
Normally, a command source will listen to the CanExecuteChanged event on the command. This informs the command source when conditions change on the command target, such as loss of keyboard focus. The command source can then query the command using the CanExecute method.
In the Windows Presentation Foundation (WPF) commanding system, the CommandTarget property on a is only applicable when the ICommand is a RoutedCommand. If the CommandTarget is set on a and the corresponding command is not a RoutedCommand, the command target is ignored.
Legacy Code Example
Available since 3.0