I defined a toolbar for a tool window by following this walk-through description.
Adding new buttons to the toolbar, and connecting them to code within my package, is no problem and works fine (So I am not looking for information on how to add simple buttons). I saw that there are other button types, like SplitDropDown and MenuButton. Both would perfectly meet my requirements. But I couldn’t find any information on how to define a sub-menu the correct way, and all my experiments failed.
This is my button definition:
<Button guid="guidVsCmdSet" id="cmdIdSplitDowndown" priority="0x106" type="SplitDropDown">
<Parent guid="guidVsCmdSet" id="VsToolbarGroup" />
<Icon guid="guidImages" id="bmpPic2" />
<CommandFlag>IconAndText</CommandFlag>
<Strings>
<CommandName>cmdIdSplitDropdown</CommandName>
<ButtonText>Goto Next</ButtonText>
</Strings>
</Button>
I want to add a SplitDropDown button having some predefined/static sub-items. I guess that the visual appearance of the button would look like the “Navigate backward” button of Visual Studio. That’s what I am trying to achieve.
Does anybody know what the definition of a SplitDropDown button, having a submenu, would look like?
It seems that the
SplitDropDownandMenuButtontypes are no longer supported by the Visual Studio IDE (at least v11, but I haven´t tested it on earlier versions. Maybe I am wrong, but I couldn´t get these kind of buttons into my toolbar). Instead, a Menu of typeMenuorMenuControllercan be used. The typeMenubehaves like the deprecatedMenuButton(even if it´s visual apperance is not exactly the same due to it´s smaller height of the button) and the typeMenuControllerbehaves like the deprecatedSplitDropDown.So, in order to get a split drop-down I added the following Menu declaration to my VSCT file:
And created a new group for the drop-down commands; the group’s parent is set to the menu.
Finally, I can add ordinary buttons to that group, which will appear as menu items.