Button 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 Button Element.

Defines an element that the user can interact with. Buttons can be of different kinds: Button, MenuButton, and SplitDropDown.

<Button guid="guidMyCommandSet" id="MyCommand" priority="0x102" type="button">  
  <Parent>... </Parent>  
  <Icon>... </Icon>  
  <CommandFlag>... </CommandFlag>  
  <Strings>... </Strings>  
</Button>  

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

Attributes

AttributeDescription
guidRequired. GUID of the GUID/ID command identifier.
idRequired. ID of the GUID/ID command identifier.
priorityOptional. A numeric value that specifies the priority.
typeOptional. An enumerated value that specifies the kind of button.

If not given, uses Button.

Button
A standard command that appears on toolbars (typically as an iconic button), menus, and context menus.

MenuButton
A menu item that does not execute a command, but produces another menu.

SplitDropDown
Controls, such as the Undo and Redo buttons on the standard toolbar in Microsoft Word.
ConditionOptional. See Conditional Attributes.

Child Elements

ElementDescription
Parent ElementOptional. The parent element of the button.
Icon ElementOptional. The icon associated with the button.
Command Flag ElementRequired. The valid CommandFlag values for a Button are as follows.

- AllowParams

- CommandWellOnly

- DefaultDisabled

- DefaultInvisible

- DontCache

- DynamicItemStart

- DynamicVisibility

- FixMenuController

- IconAndText

- NoButtonCustomize

- NoCustomize

- NoKeyCustomize

- NoShowOnMenuController

- Pict

- PostExec

- ProfferedCmd

- RouteToDocs

- TextCascadeUseBtn

- TextMenuUseButton

- TextChanges

- TextChangesButton

- TextContextUseButton

- TextMenuCtrlUseMenu

- TextMenuUseButton

- TextOnly
Strings ElementRequired. The child ButtonText Element must be defined.
AnnotationOptional comment.

Parent Elements

ElementDescription
Buttons ElementGroups Button elements.

The following example defines a button in a .vsct file.

Visual Studio Command Table (.Vsct) Files

Show: