# Keyboard Shortcuts

This topic covers keyboard shortcuts for navigating across ribbon control.

## Content

The **C1Ribbon** control supports keyboard shortcuts. You can perform tasks quickly by simply pressing a few keys. The user can access every command in the Ribbon using a key. For instance, to make the text bold, you can use the combination of **Ctrl** and **B** keys.

>type=note
> **Note**: This topic assumes that you have added a Ribbon button to the group and created a **RibbonButton.Click** event handler for the Bold button.

Complete the following steps for keyboard shortcuts.

1. Change the **Windows Form** to **Ribbon Form**.
2. Select the **Ribbon button** (in this case, the Bold button) to display its properties in the **Properties** window.
3. Locate the **ShortcutKeys** property and select the **Ctrl** check box and select **B** from the drop-down list.
    ![locate shortcut key property](https://cdn.mescius.io/document-site-files/images/5560dc72-88a5-4eeb-a384-981194dfc831/images/shortcutkeys.png)
4. Click outside the Shortcut Keys editor to accept the changes. Save and run the application.
    Now when you run the application, pressing the **CTRL+B** key combination will trigger the **RibbonButton.Click** event for the Bold button and make the selected text bold in style.

You can also add keyboard shortcuts to the Ribbon control programmatically using the ShortcutKeyDisplayString and ShortcutKeys properties of <span data-popup-content="This class is available in \u003ca href=\u0022/componentone/docs/win/online-ribbon/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-ribbon/\u0022\u003e.NET Framework\u003c/a\u003e." data-popup-title="RibbonButton" data-popup-theme="ui-tooltip-green qtip-green">RibbonButton</span> class.

```vbnet
Private Sub KeyboardShortcuts_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'Set Keyboard shortcut for Bold button
    boldButton.ShortcutKeyDisplayString = "Bold"
    boldButton.ShortcutKeys = (Keys.Control Or Keys.B)
    'Set Keyboard shortcut for Italic button
    italicButton.ShortcutKeyDisplayString = "Italic"
    italicButton.ShortcutKeys = (Keys.Control Or Keys.I)
    'Set Keyboard shortcut for Underline button
    underlineButton.ShortcutKeyDisplayString = "Underline"
    underlineButton.ShortcutKeys = (Keys.Control Or Keys.U)
End Sub
Private Sub boldButton_Click(sender As Object, e As EventArgs) Handles boldButton.Click
    RichTextBox1.SelectionFont = New Font("Times New Roman", 12, FontStyle.Bold)
End Sub
Private Sub italicButton_Click(sender As Object, e As EventArgs) Handles italicButton.Click
    RichTextBox1.SelectionFont = New Font("Times New Roman", 12, FontStyle.Italic)
End Sub
Private Sub underlineButton_Click(sender As Object, e As EventArgs) Handles underlineButton.Click
    RichTextBox1.SelectionFont = New Font("Times New Roman", 12, FontStyle.Underline)
End Sub
```

```csharp
public KeyboardShortcuts()
{
    InitializeComponent();
    //Set Keyboard shortcut for Bold button
    boldButton.ShortcutKeyDisplayString = "Bold";            
    boldButton.ShortcutKeys = (Keys.Control | Keys.B);
    //Set Keyboard shortcut for Italic button
    italicButton.ShortcutKeyDisplayString = "Italic";
    italicButton.ShortcutKeys = (Keys.Control | Keys.I);
    //Set Keyboard shortcut for Underline button
    underlineButton.ShortcutKeyDisplayString = "Underline";
    underlineButton.ShortcutKeys = (Keys.Control | Keys.U);
}
private void boldButton_Click(object sender, EventArgs e)
{
    richTextBox1.SelectionFont = new Font("Calibri", 12, FontStyle.Bold);
}
private void italicButton_Click(object sender, EventArgs e)
{
    richTextBox1.SelectionFont = new Font("Calibri", 12, FontStyle.Italic);
}
private void underlineButton_Click(object sender, EventArgs e)
{
    richTextBox1.SelectionFont = new Font("Calibri", 12, FontStyle.Underline);
}
```

### Adding KeyTips to Ribbon Items

KeyTips, also known as access keys or accelerators are single letter or number displayed below or next to a Ribbon tab, command or drop-down menu. They can be used as shortcut key combinations to access or activate control. The **C1Ribbon** control supports KeyTips, with which you can display all the commands on the Ribbon. It allows you to move between elements on the C1Ribbon control using keyboard commands.

In order to see KeyTips for each command, the user can press and release the **ALT** or **F10** key.

The image below illustrates the KeyTips for **Home** and **Font** tabs:

![key tips example](https://cdn.mescius.io/document-site-files/images/5560dc72-88a5-4eeb-a384-981194dfc831/images/keytips.png)

You can set the KeyTip for all the Ribbon items using **KeyTip** property of the **RibbonButton** class. The following code snippet illustrates adding KeyTips for the Ribbon items.

```vbnet
'Set Keytip for Home/Font Tab
homeTab.KeyTip = "H"
fontTab.KeyTip = "F"
'Set Keytip for Bold/Italic/Underline button in Home tab
boldButton.KeyTip = "B"
italicButton.KeyTip = "I"
underlineButton.KeyTip = "U"
'Set Keytip for FontComboBox/ColorPicker in Font tab
RibbonFontComboBox1.KeyTip = "T"
RibbonColorPicker1.KeyTip = "C"
```

```csharp
//Set Keytip for Home/Font Tab
homeTab.KeyTip = "H";            
fontTab.KeyTip = "F";
//Set Keytip for Bold/Italic/Underline button in Home tab
boldButton.KeyTip = "B";            
italicButton.KeyTip = "I";           
underlineButton.KeyTip = "U";
//Set Keytip for FontComboBox/ColorPicker in Font tab
ribbonFontComboBox1.KeyTip = "T";            
ribbonColorPicker1.KeyTip = "C";
```

>type=note
> Note: KeyTip should always be set in the order of Ribbon elements hierarchy. That is, you need to set the KeyTip property for the Tab group before setting the KeyTip for the Ribbon element inside that group.