Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

KeyShortcut(Shortcut) Constructor

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

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v24.2.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