KeyBinding Element

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at KeyBinding Element.

The KeyBinding element specifies keyboard shortcuts for the commands.

Commands can have both single and dual key bindings associated with them. An example of a single key binding is CTRL+S for the Save command. Dual key bindings require two successive key combinations to trigger a command. An example of a dual key binding is CTRL+K,CTRL+K to set a bookmark.

<Keybinding guid="MyGuid" id="MyId" Editor="MyEditor" key1="B" key2="x" mod1="Control" mod2="Alt" />  

The following sections describe attributes, child elements, and parent elements.

Attributes

AttributeDescription
guidRequired.
idRequired.
editorRequired. The editor GUID indicates the editing context for which this keyboard shortcut will be active. The global binding scope value is "guidVSStd97".
key1Required. Valid values include all typable alphanumerics, and also two-digit hexadecimal values preceded by 0x and VK_constants.
mod1Optional. Any combination of CTRL, ALT, and SHIFT separated by space.
key2Optional. Valid values include all typable alphanumerics, and also two-digit hexadecimal values preceded by 0x and VK_constants.
mod2Optional. Any combination of CTRL, ALT, and SHIFT separated by space.
emulatorOptional.
ConditionOptional. See Conditional Attributes.

Child Elements

ElementDescription
Parent
Annotation

Parent Elements

ElementDescription
KeyBindings ElementGroups KeyBinding elements and other KeyBindings groupings.
<KeyBindings>  
  <KeyBinding guid="guidWidgetPackage" id="cmdidUpdateWidget"   
    editor="guidWidgetEditor" key1="VK_F5"/>  
  <KeyBinding guid="guidWidgetPackage" id="cmdidRunWidget"   
    editor="guidWidgetEditor" key1="VK_F5" mod1="Control"/>  
</KeyBindings>  

KeyBindings Element
Visual Studio Command Table (.Vsct) Files

Show: