CommandBarPopups with an image (not possible) and split dropdowns (not possible either).

Today I received in the e-mail a question about how to create a commandbar popup with an image in a Visual Studio add-in. The short answer is that commandbar popups can’t have images but I will ellaborate it here a bit more.

First, we need to define what a commandbar popup is. A commandbar popup is a special button (on a toolbar) or menu entry (on a menu) that when clicked, rather than performing an action like a regular button, it shows new buttons or menu entries. For that reason commandbar popups show an arrow to the right of its caption (>). Examples of commandbar popups in Visual Studio are:

  • The File, New menu item
  • The Tools, Macros menu item.
  • Etc.

None of those commandbar popups have (or can have) an image. You can create commandbar popups as explained in my articles:

HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in.

HOWTO: Add a popup command bar to the context menu of a code window of Visual Studio .NET.

Now, there are other kind of “popups” and “dropdowns” in Visual Studio:

  • The “dropdown combo”. For example, the Configuration Manager combobox in the Standard toolbar, which allows you to select the active configuration (“Debug”, “Release”). Although not very useful for most add-ins, the good news is that you can actually create them with an add-in as Craig Skibo (formerly in the MS VS extensibility team) explained long time ago here: Command Bar Types – Part 2
  • The “split dropdown” (I am not 100% sure about whether this is the correct name, but I think it is). This is a special button that appears on toolbars (not on menus) and has two (splitted) zones: a button with an image that when clicked performs some action, and an arrow than when clicked drops down new buttons. An example of this control is the New Project button on the Standard toolbar. If you click the button, you create a new project. If you click the arrow, it shows buttons to create a project, web site, team project, etc. Notice that the image of the button and its associated action reflects the last used button, so this is also a kind of MRU control which wouldn’t be desirable in some scenarios for add-ins (that is, it is not actually like a commandbar popup). AFAIK, you can’t create this kind of control using an add-in although apparently there was some intention from Microsoft to support it (see my comment in the Craig’s post).

One thought on “CommandBarPopups with an image (not possible) and split dropdowns (not possible either).”

  1. Hi,

    The statements that you have writtem is seems to be correct, because I am unable to add the image to the popup menu control. But whatever I have seen in Excel as well as Outllok there are some popup menus which have the images and caption i.e. “send/receive” popup menu. My question is how these people have add the image in the mentioned popups menus.

    If you get the answer, please update the blog.

Comments are closed.