Touch and Keyboard in Windows Forms PopupMenu

Touch

Touch mode is used to access the control easily in touch devices. By default, touch support is enabled in PopupMenu control.

Keyboard Shortcuts

The bar items can be selected through keyboard operation by specifying the shortcuts via the Shortcut property of the bar item.

NOTE

  1. By using this keyboard shortcuts we can access the bar items through Click event.
  2. In this illustration, we have used BarItem. Similarly, we have set the shortcuts for ParentBarItem, DropDownBarItem, ComboBoxBarItem, ListBarItem, StaticBarItem and TextBoxBarItem.

The below code snippet shows how shortcut is assigned to the bar item.

this.barItem1.Shortcut = System.Windows.Forms.Shortcut.CtrlF;
Me.barItem1.Shortcut = System.Windows.Forms.Shortcut.CtrlF

Keyboard Shortcuts

User can also specify custom text in place of keyboard shortcuts region using the ShortcutText property.

this.barItem1.Shortcut = System.Windows.Forms.Shortcut.CtrlF;
this.barItem1.ShortcutText = "Press Ctrl + F";
Me.barItem1.Shortcut = System.Windows.Forms.Shortcut.CtrlF
Me.barItem1.ShortcutText = "Press Ctrl + F"

Keyboard Shortcuts

Keyboard Mnemonics

The bar items of popup menu support to add mnemonic text. The required character is appended with & symbol in the Text property of the bar item. Mnemonics can be visible by setting the ShowMnemonicUnderlinesAlways property of the bar item as true.

The below code snippet shows the bar items with the mnemonics.

this.barItem1.Text = "&File";
this.barItem1.ShowMnemonicUnderlinesAlways = true;
Me.barItem1.Text = "&File"
Me.barItem1.ShowMnemonicUnderlinesAlways = True

Mnemonics