BarManager.ShortcutItemClick Event

Allows you to stop a bar item’s shortcut that has been pressed from being processed by XtraBars.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v21.1.dll


public event ShortcutItemClickEventHandler ShortcutItemClick

Event Data

The ShortcutItemClick event's data class is ShortcutItemClickEventArgs. The following properties provide information specific to this event:

Property Description
Accelerator Gets the hotkey combination an end-user has pressed.
Cancel Gets or sets whether to stop processing a pressed shortcut and so stop the bar item’s functionality from being invoked.
Item Gets the BarItem whose functionality is about to be invoked.
Shortcut Gets the keystroke shortcut for the bar item.


It is possible to assign a shortcut to any bar item via the BarItem.ShortCut property.

When a shortcut is invoked for any of the form’s controls, the Bar Manager invokes the corresponding bar item’s functionality, i.e. the item’s BarItem.ItemClick event is fired. The currently focused control will not receive this shortcut.

To stop a BarManager’s shortcut from being processed, handle the ShortcutItemClick event and set the Cancel parameter to true, as your needs dictate. For instance, you could do this only when a specific shortcut is pressed and a particular control(s) has focus. In this case, the bar item’s functionality will not be invoked and the focused control will receive this key combination.

In an MDI application, when both the parent and child forms have their own Bar Manager components, and the child form is hosted within the parent form, you need to handle the ShortcutItemClick event for both the parent and child Bar Manager components.


Let us assume, that a form contains the following components:

  • list box
  • Bar Manager with a bar containing the Del bar item which is intended to delete the focused element from the list box. Its shortcut is set to the DELETE key.
  • a text box. Pressing the DELETE key while editing in the text box should clear the selected text

By default, when any control is focused, pressing the DELETE key will always invoke the bar item’s functionality. To prevent this when the text box is focused, we need to handle the BarManager.ShortcutItemClick event.

private void barManager1_ShortcutItemClick(object sender, 
  DevExpress.XtraBars.ShortcutItemClickEventArgs e) {
    if(e.Shortcut.Key == Keys.Delete)
        e.Cancel = textBox1.Focused;
See Also