Command​Manager Class

Definition

Provides command related utility methods that register CommandBinding and InputBinding objects for class owners and commands, add and remove command event handlers, and provides services for querying the status of a command.

public sealed class CommandManager
Inheritance
CommandManager

Inherited Members

System.Object

Remarks

The CommandManager is responsible for managing routed commands. For more information about commanding, see Commanding Overview.

Use RegisterClassCommandBinding to register a CommandBinding to a class as opposed to an instance.

Use RegisterClassInputBinding to register an InputBinding to a class as opposed to an instance.

The InvalidateRequerySuggested method forces the CommandManager to raise the RequerySuggested event. The RequerySuggested event informs a command source to query the command it is associated with to determine whether or not the command can execute.

Fields

Can​Execute​Event

Identifies the CanExecute attached event.

Executed​Event

Identifies the Executed attached event.

Preview​Can​Execute​Event

Identifies the PreviewCanExecute attached event.

Preview​Executed​Event

Identifies the PreviewExecuted attached event.

Methods

Add​Can​Execute​Handler(​UI​Element, ​Can​Execute​Routed​Event​Handler)

Attaches the specified CanExecuteRoutedEventHandler to the specified element.

Add​Executed​Handler(​UI​Element, ​Executed​Routed​Event​Handler)

Attaches the specified ExecutedRoutedEventHandler to the specified element.

Add​Preview​Can​Execute​Handler(​UI​Element, ​Can​Execute​Routed​Event​Handler)

Attaches the specified CanExecuteRoutedEventHandler to the specified element.

Add​Preview​Executed​Handler(​UI​Element, ​Executed​Routed​Event​Handler)

Attaches the specified ExecutedRoutedEventHandler to the specified element.

Invalidate​Requery​Suggested()

Forces the CommandManager to raise the RequerySuggested event.

Register​Class​Command​Binding(​Type, ​Command​Binding)

Registers a CommandBinding with the specified type.

Register​Class​Input​Binding(​Type, ​Input​Binding)

Registers the specified InputBinding with the specified type.

Remove​Can​Execute​Handler(​UI​Element, ​Can​Execute​Routed​Event​Handler)

Detaches the specified CanExecuteRoutedEventHandler from the specified element.

Remove​Executed​Handler(​UI​Element, ​Executed​Routed​Event​Handler)

Detaches the specified ExecutedRoutedEventHandler from the specified element.

Remove​Preview​Can​Execute​Handler(​UI​Element, ​Can​Execute​Routed​Event​Handler)

Detaches the specified CanExecuteRoutedEventHandler from the specified element.

Remove​Preview​Executed​Handler(​UI​Element, ​Executed​Routed​Event​Handler)

Detaches the specified ExecutedRoutedEventHandler from the specified element.

Events

Requery​Suggested

Occurs when the CommandManager detects conditions that might change the ability of a command to execute.