Back to Devexpress

ReportDesigner.RegisterHotKey(Key, ModifierKeys, Func<ICommand>, Object) Method

wpf-devexpress-dot-xpf-dot-reports-dot-userdesigner-dot-reportdesigner-dot-registerhotkey-x28-key-modifierkeys-func-icommand-object-x29.md

latest4.8 KB
Original Source

ReportDesigner.RegisterHotKey(Key, ModifierKeys, Func<ICommand>, Object) Method

Registers the specified hot key in the Report Designer.

Namespace : DevExpress.Xpf.Reports.UserDesigner

Assembly : DevExpress.Xpf.ReportDesigner.v25.2.dll

NuGet Package : DevExpress.Wpf.Reporting

Declaration

csharp
public void RegisterHotKey(
    Key key,
    ModifierKeys modifiers,
    Func<ICommand> getCommand,
    object parameter
)
vb
Public Sub RegisterHotKey(
    key As Key,
    modifiers As ModifierKeys,
    getCommand As Func(Of ICommand),
    parameter As Object
)

Parameters

NameTypeDescription
keyKey

A Key enumeration value that specifies the hot key to be registered.

| | modifiers | ModifierKeys |

A ModifierKeys enumeration value that specifies modifier keys that should be pressed in combination with the key.

| | getCommand | Func<ICommand> |

A function that returns a command to be executed when the hot key is pressed.

| | parameter | Object |

An object that specifies a command parameter.

|

Remarks

The following code snippet demonstrates how to register the hot key to invoke the Save As dialog.

csharp
using System.Windows.Input;
// ...

reportDesigner.RegisterHotKey(Key.S, ModifierKeys.Control, 
    () => reportDesigner.ActualCommands.SaveDocumentAsCommand, null);
vb
Imports System.Windows.Input
' ...

reportDesigner.RegisterHotKey(Key.S, ModifierKeys.Control, 
    Function() reportDesigner.ActualCommands.SaveDocumentAsCommand, Nothing)

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RegisterHotKey(Key, ModifierKeys, Func<ICommand>, Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-wpf-customize-keyboard-shortcuts-in-the-report-designer/CS/T461248/MainWindow.xaml.cs#L20

csharp
designer.RegisterHotKey(Key.OemTilde, ModifierKeys.Control, () => viewModel.TestCommand, null);
}

reporting-wpf-customize-keyboard-shortcuts-in-the-report-designer/VB/T461248/MainWindow.xaml.vb#L22

vb
DataContext = viewModel
    Me.designer.RegisterHotKey(Key.OemTilde, ModifierKeys.Control, Function() viewModel.TestCommand, Nothing)
End Sub

See Also

ActualCommands

ReportDesignerCommands

UnregisterHotKey(Key, ModifierKeys)

UnregisterHotKeys()

ReportDesigner Class

ReportDesigner Members

DevExpress.Xpf.Reports.UserDesigner Namespace