Export (0) Print
Expand All

CommandManager Class

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.

System.Object
  System.Windows.Input.CommandManager

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public sealed class CommandManager

The CommandManager type exposes the following members.

  NameDescription
Public methodStatic memberAddCanExecuteHandlerAttaches the specified CanExecuteRoutedEventHandler to the specified element.
Public methodStatic memberAddExecutedHandlerAttaches the specified ExecutedRoutedEventHandler to the specified element.
Public methodStatic memberAddPreviewCanExecuteHandlerAttaches the specified CanExecuteRoutedEventHandler to the specified element.
Public methodStatic memberAddPreviewExecutedHandlerAttaches the specified ExecutedRoutedEventHandler to the specified element.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberInvalidateRequerySuggestedForces the CommandManager to raise the RequerySuggested event.
Public methodStatic memberRegisterClassCommandBindingRegisters a CommandBinding with the specified type.
Public methodStatic memberRegisterClassInputBindingRegisters the specified InputBinding with the specified type.
Public methodStatic memberRemoveCanExecuteHandlerDetaches the specified CanExecuteRoutedEventHandler from the specified element.
Public methodStatic memberRemoveExecutedHandlerDetaches the specified ExecutedRoutedEventHandler from the specified element.
Public methodStatic memberRemovePreviewCanExecuteHandlerDetaches the specified CanExecuteRoutedEventHandler from the specified element.
Public methodStatic memberRemovePreviewExecutedHandlerDetaches the specified ExecutedRoutedEventHandler from the specified element.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventStatic memberRequerySuggestedOccurs when the CommandManager detects conditions that might change the ability of a command to execute.
Top

  NameDescription
Public attached eventCanExecuteOccurs when the CanExecute method on the RoutedCommand is called and the PreviewCanExecute event was not handled.
Public attached eventExecutedOccurs when the Execute method on the RoutedCommand is called and the PreviewExecuted event was not handled.
Public attached eventPreviewCanExecuteOccurs when the CanExecute method on the RoutedCommand is called.
Public attached eventPreviewExecutedOccurs when the Execute method on the RoutedCommand is called.
Top

  NameDescription
Public fieldStatic memberCanExecuteEventIdentifies the CanExecute attached event.
Public fieldStatic memberExecutedEventIdentifies the Executed attached event.
Public fieldStatic memberPreviewCanExecuteEventIdentifies the PreviewCanExecute attached event.
Public fieldStatic memberPreviewExecutedEventIdentifies the PreviewExecuted attached event.
Top

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.

.NET Framework

Supported in: 4.5.3, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft