CommandManager CommandManager CommandManager CommandManager 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 ref class CommandManager sealed
public sealed class CommandManager
type CommandManager = class
Public NotInheritable Class CommandManager
Inheritance
CommandManagerCommandManagerCommandManagerCommandManager

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

CanExecuteEvent CanExecuteEvent CanExecuteEvent CanExecuteEvent

Identifies the CanExecute attached event.

ExecutedEvent ExecutedEvent ExecutedEvent ExecutedEvent

Identifies the Executed attached event.

PreviewCanExecuteEvent PreviewCanExecuteEvent PreviewCanExecuteEvent PreviewCanExecuteEvent

Identifies the PreviewCanExecute attached event.

PreviewExecutedEvent PreviewExecutedEvent PreviewExecutedEvent PreviewExecutedEvent

Identifies the PreviewExecuted attached event.

Methods

AddCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) AddCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) AddCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) AddCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler)

Attaches the specified CanExecuteRoutedEventHandler to the specified element.

AddExecutedHandler(UIElement, ExecutedRoutedEventHandler) AddExecutedHandler(UIElement, ExecutedRoutedEventHandler) AddExecutedHandler(UIElement, ExecutedRoutedEventHandler) AddExecutedHandler(UIElement, ExecutedRoutedEventHandler)

Attaches the specified ExecutedRoutedEventHandler to the specified element.

AddPreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) AddPreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) AddPreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) AddPreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler)

Attaches the specified CanExecuteRoutedEventHandler to the specified element.

AddPreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler) AddPreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler) AddPreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler) AddPreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler)

Attaches the specified ExecutedRoutedEventHandler to the specified element.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InvalidateRequerySuggested() InvalidateRequerySuggested() InvalidateRequerySuggested() InvalidateRequerySuggested()

Forces the CommandManager to raise the RequerySuggested event.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RegisterClassCommandBinding(Type, CommandBinding) RegisterClassCommandBinding(Type, CommandBinding) RegisterClassCommandBinding(Type, CommandBinding) RegisterClassCommandBinding(Type, CommandBinding)

Registers a CommandBinding with the specified type.

RegisterClassInputBinding(Type, InputBinding) RegisterClassInputBinding(Type, InputBinding) RegisterClassInputBinding(Type, InputBinding) RegisterClassInputBinding(Type, InputBinding)

Registers the specified InputBinding with the specified type.

RemoveCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) RemoveCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) RemoveCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) RemoveCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler)

Detaches the specified CanExecuteRoutedEventHandler from the specified element.

RemoveExecutedHandler(UIElement, ExecutedRoutedEventHandler) RemoveExecutedHandler(UIElement, ExecutedRoutedEventHandler) RemoveExecutedHandler(UIElement, ExecutedRoutedEventHandler) RemoveExecutedHandler(UIElement, ExecutedRoutedEventHandler)

Detaches the specified ExecutedRoutedEventHandler from the specified element.

RemovePreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) RemovePreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) RemovePreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler) RemovePreviewCanExecuteHandler(UIElement, CanExecuteRoutedEventHandler)

Detaches the specified CanExecuteRoutedEventHandler from the specified element.

RemovePreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler) RemovePreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler) RemovePreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler) RemovePreviewExecutedHandler(UIElement, ExecutedRoutedEventHandler)

Detaches the specified ExecutedRoutedEventHandler from the specified element.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

RequerySuggested RequerySuggested RequerySuggested RequerySuggested

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

Attached Events

CanExecute CanExecute CanExecute CanExecute

Occurs when the CanExecute(Object, IInputElement) method on the RoutedCommand is called and the PreviewCanExecute event was not handled.

Executed Executed Executed Executed

Occurs when the Execute(Object, IInputElement) method on the RoutedCommand is called and the PreviewExecuted event was not handled.

PreviewCanExecute PreviewCanExecute PreviewCanExecute PreviewCanExecute

Occurs when the CanExecute(Object, IInputElement) method on the RoutedCommand is called.

PreviewExecuted PreviewExecuted PreviewExecuted PreviewExecuted

Occurs when the Execute(Object, IInputElement) method on the RoutedCommand is called.

Applies to

See also