Condividi tramite


Extending Menus and Commands

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Commands are the way you add actions and processes to Visual Studio. In most cases commands are displayed on menus or toolbars. The VSPackage project template shows how to implement a very basic command. For a slightly longer but still basic implementation, see Creating an Extension with a Menu Command.

For more information about Visual Studio commands, menus and toolbars, see Commands, Menus, and Toolbars.

Commands, menus, and toolbars are defined in the .vsct file that is part of VSPackage projects. You can find information about the Visual Studio IDE and the .vsct file in How VSPackages Add User Interface Elements.

The following topics explain how to add different kinds of commands, menus, and toolbars.

In This Section

Adding a Menu to the Visual Studio Menu Bar
Explains how to add a menu to the top Visual Studio menu bar.

Binding Keyboard Shortcuts to Menu Items
Explains how to add a keyboard shortcut (such as CTRL + 3) to a menu item.

Adding a Submenu to a Menu
Explains how to add a submenu to the top menu.

Adding a Most Recently Used List to a Submenu
Explains how to add a Most Recently Used list.

Creating Reusable Groups of Buttons
Describes how to group command items so that they can be included on multiple menus.

Adding Icons to Menu Commands
Describes how to add an icon to a command on both a toolbar and a menu.

Changing the Text of a Menu Command
Describes the use of the TextChanges flag to enable a menu item to be changed dynamically.

Changing the Appearance of a Command
Describes how to dynamically enable or disable a command.

Updating the User Interface
Describes how to force an update of the user interface to reflect recent changes.

Localizing Menu Commands
Explains how to localize menu commands.