Back to Devexpress

DiagramCommandsBase.RegisterHotKeys(Action<IHotKeysRegistrator>) Method

corelibraries-devexpress-dot-diagram-dot-core-dot-diagramcommandsbase-dot-registerhotkeys-x28-system-dot-action-devexpress-dot-diagram-dot-core-dot-ihotkeysregistrator-x29.md

latest2.3 KB
Original Source

DiagramCommandsBase.RegisterHotKeys(Action<IHotKeysRegistrator>) Method

Allows you to clear the existing shortcuts or define new ones.

Namespace : DevExpress.Diagram.Core

Assembly : DevExpress.Diagram.v25.2.Core.dll

NuGet Package : DevExpress.Diagram.Core

Declaration

csharp
public ICommandHotKeys RegisterHotKeys(
    Action<IHotKeysRegistrator> registerHotKeys
)
vb
Public Function RegisterHotKeys(
    registerHotKeys As Action(Of IHotKeysRegistrator)
) As ICommandHotKeys

Parameters

NameTypeDescription
registerHotKeysAction<DevExpress.Diagram.Core.IHotKeysRegistrator>

An action delegate that clears the existing shortcuts or registers custom ones.

|

Returns

TypeDescription
DevExpress.Diagram.Core.ICommandHotKeys

A collection of command handlers.

|

Remarks

The example below shows how set the F10 key as a shortcut that invokes the Print Preview and clear the shortcut associated with saving the diagram to a file.

csharp
diagram.Commands.RegisterHotKeys(x => {
                x.RegisterHotKey(Key.F10, ModifierKeys.None, DiagramCommandsBase.ShowPrintPreviewCommand);
                x.ClearHotKeys(DiagramCommandsBase.SaveFileCommand);
            });
vb
diagram.Commands.RegisterHotKeys(Sub(x)
                x.RegisterHotKey(Key.F10, ModifierKeys.None, DiagramCommandsBase.ShowPrintPreviewCommand)
                x.ClearHotKeys(DiagramCommandsBase.SaveFileCommand)
            End Sub)

See Also

DiagramCommandsBase Class

DiagramCommandsBase Members

DevExpress.Diagram.Core Namespace