Bindings Property Parameter Format
The Bindings property has a specific parameter format which you must follow, or you will receive an error. The parameters required are following.
The parameter format is: Scope::ModifierKeys1+Key1,ModifierKeys2+Key2.
The following shows two keybindings that apply to one command in the Global scope. These key bindings are Ctrl-Shift-D followed by the O key and Ctrl-Shift-D followed by the F key: Global::Ctrl+Shift+D,O,Ctrl+Shift+D,F.
In this case, the modifier keys and key values are:
If you are using Visual Studio with the default settings, then the assigned shortcut key for the File.NewFile command is Global::Ctrl+N. This means that pressing and holding CTRL while pressing N displays the New File dialog box. The Global keyword means that the command works in all areas of Visual Studio.
The Scope parameter indicates the context in which the shortcut key works. The Global keyword defines that it works anywhere in Visual Studio, while a specific scope defines that it works only in that scope. Global is the most often-used scope. The available values for Scope depend on the package.
For example, CTRL+B makes the selected text bold when in the HTML editor, but the same key combination displays the Debugger Breakpoints dialog box if the editor is inactive. If you were to apply a Global scope to this shortcut key combination, then CTRL+B would work (or attempt to work) the same everywhere in Visual Studio, rather than only in the HTML editor.
Regardless of the scope you use, you must follow it with two colons (::) before specifying the other parameters.
Modifier keys are system keys that you press while pressing another key. The available modifier keys are CTRL, SHIFT, and ALT. You can combine more than one modifier key by separating them with a + sign. For example: CTRL+ALT+X or SHIFT+ALT+Y. You can also specify multiple letters, such as CTRL+ALT+Y, N, meaning you press CTRL+ALT+Y and then the N key.
A key is any key on a standard 102-key keyboard. Excluded keys on newer keyboards are: the Windows key, multimedia keys (such as favorites, volume, stop, etc.), and the Fn key on some portable computers. Keys other than the standard letter and number keys are known as virtual keys. The following table lists all virtual keys that the Bindings property accepts. Any virtual key not in this list is ignored.
Modifier Keys2 and Key2
These optional additional keys let you expand your command groups and avoid shortcut key collisions. For example, you could assign CTRL+SHIFT+D, O to open a file in the file editor, and you could assign CTRL+SHIFT+D, S to save the file. Also, this lets you group similar commands under the same keyboard shortcut for ease of use and memorization. It also avoids expending all the shorter available shortcut keys that are frequently used by other commands.