Skip to main content

KeyShortcut(Shortcut) Constructor

Creates an instance of the KeyShortcut class with the specified shortcut.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v24.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public KeyShortcut(
    Shortcut shortcut
)

Parameters

Name Type Description
shortcut Shortcut

The key combination to initialize the KeyShortcut.Key property.

Remarks

The constructor creates a KeyShortcut object and sets its shortcut to the specified value. The shortcut passed as a parameter is cast to the Keys type and assigned to the KeyShortcut.Key property.

The Shortcut type provides a limited number of key combinations. To create a shortcut for any key combination, use another constructor overload which takes the Keys value as a parameter. Values of the Keys type can be combined using the OR operator.

Example

The following code assigns the Ctrl+1 shortcut to the first button within a button editor. Pressing this shortcut activates the button’s functionality which can be implemented via the RepositoryItemButtonEdit.ButtonClick event.

    buttonEdit1.Properties.Buttons[0].Shortcut = new KeyShortcut(Shortcut.Ctrl1);
See Also