Skip to end of metadata
Go to start of metadata

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.

CommandManager 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.


Working with RegisterClassCommandBinding(Type, CommandBinding) Method

In addition to instance command binding, the commanding framework in ClientUI also supports class command binding API which is available in the CommandManager class. The class command binding is particularly useful when you have a fairly large amount of commands to bind to the controls.

The following code example shows how to use class command binding API to register a routed command on a specific type rather than an instance.

C#

For a more complete version of this example, see How-to: Use Class Binding to Implement a RoutedCommand.

Working with RegisterClassInputBinding(Type, InputBinding) Method

In addition to instance command binding, the commanding framework in ClientUI also supports class command binding API which is available in the CommandManager class. The class input binding is particularly useful when you have a fairly large amount of controls where the key gesture is bound to.

The following code example shows how to use class input binding API to register a key gesture on a specific type rather than an instance.

Definition

public sealed class CommandManager : DependencyObject

Summary

The following table summarizes the members exposed in this class.

Fields

CanExecuteEventIdentifies the CanExecute routed event.
CommandBindingsPropertyIdentifies the CanExecute attached property.
ExecutedEventIdentifies the Executed routed event.
InputBindingsPropertyIdentifies the InputBindings attached property.
PreviewCanExecuteEventIdentifies the PreviewCanExecute routed event.
PreviewExecutedEventIdentifies the PreviewExecutedEvent routed event.

Static Methods


Fields

public static readonly RoutedEvent CanExecuteEvent

Identifies the CanExecute routed event.

public static readonly DependencyProperty CommandBindingsProperty

Identifies the CanExecute attached property.

public static readonly RoutedEvent ExecutedEvent

Identifies the Executed routed event.

public static readonly DependencyProperty InputBindingsProperty

Identifies the InputBindings attached property.

public static readonly RoutedEvent PreviewCanExecuteEvent

Identifies the PreviewCanExecute routed event.

public static readonly RoutedEvent PreviewExecutedEvent

Identifies the PreviewExecutedEvent routed event.

Static Methods

public static void AddCanExecuteHandler(DependencyObject element, CanExecuteRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static void AddExecutedHandler(DependencyObject element, ExecutedRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static void AddPreviewCanExecuteHandler(DependencyObject element, CanExecuteRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static void AddPreviewExecutedHandler(DependencyObject element, ExecutedRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static CommandBindingCollection GetCommandBindings(DependencyObject element)

 

Parameters

element 

 

public static InputBindingCollection GetInputBindings(DependencyObject element)

 

Parameters

element 

 

public static void InvalidateRequerySuggested()

 

public static void RegisterClassCommandBinding(Type type, CommandBinding commandBinding)

 

Parameters

type 
commandBinding 

 

public static void RegisterClassInputBinding(Type type, InputBinding inputBinding)

 

Parameters

type 
inputBinding 

 

public static void RemoveCanExecuteHandler(DependencyObject element, CanExecuteRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static void RemoveExecutedHandler(DependencyObject element, ExecutedRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static void RemovePreviewCanExecuteHandler(DependencyObject element, CanExecuteRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static void RemovePreviewExecutedHandler(DependencyObject element, ExecutedRoutedEventHandler handler)

 

Parameters

element 
handler 

 

public static void SetCommandBindings(DependencyObject element, CommandBindingCollection value)

 

Parameters

element 
value 

 

public static void SetInputBindings(DependencyObject element, InputBindingCollection value)

 

Parameters

element 
value 
  • No labels