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)

[<Sealed>]
type CommandManager =  class end

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.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberInvalidateRequerySuggestedForces the CommandManager to raise the RequerySuggested event.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
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, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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.

Community Additions

ADD
Show:
© 2014 Microsoft