Bar

BarItem.ItemShortcut Property

Gets or sets the shortcut used to access associated links using the keyboard.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v20.1.dll

Declaration

[DXCategory("Behavior")]
public virtual BarShortcut ItemShortcut { get; set; }
<DXCategory("Behavior")>
Public Overridable Property ItemShortcut As BarShortcut

Property Value

Type Description
BarShortcut

A BarShortcut object specifying the key combination used to access links associated with this item.

Remarks

You can respond to link clicks by handling the BarItem.ItemClick or BarManager.ItemClick event. The same events are raised when you press the ItemShortcut key combination.

Bar items do not appear depressed when a user presses shortcuts. Shortcuts cannot be used to expand sub-menus.

At design time, use the combo box available for the ItemShortcut property in the Visual Studio Property Grid to select one of the predefined shortcuts. Choose (custom) to invoke the custom shortcut editor.

BarItem.ItemShortcut

Up to two successive combinations can be specified. For instance, you can specify the "CTRL+J, CTRL+K" shortcut for an item. Note that in this case, you cannot use the first combination ("CTRL+J") alone for another item.

At runtime, you can specify a shortcut as follows:


barButtonItem1.ItemShortcut = new DevExpress.XtraBars.BarShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.M));
barButtonItem2.ItemShortcut = new DevExpress.XtraBars.BarShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.J), (System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.K));

The text representation of item shortcuts is displayed for items when they are embedded in a popup menu or sub-menu, and the menu's MenuDrawMode property is set to SmallImagesText.

To provide a custom display string for the assigned shortcut, use the BarItem.ShortcutKeyDisplayString property.

NOTE

Do not assign system shortcuts to bar items. For instance, the Ctrl+A shortcut is used to select text in a text box. The Ctrl+C shortcut is used to copy the selected text. The Esc shortcut is used to close dropdown windows. Do not assign these shortcuts and such to bar items. Otherwise, conflicts and unpredictable results may occur.

See Also