locked
How to add custom controls into the toolbar in VS addin? RRS feed

  • Question

  • I have a VS addin, by implementing IDTExtensibility2. I am using VS2010, and making addin for VS2010.

    I'd like to add a custom control into the VS toolbar, but I can just add usual button and dropdowncombo, if I call the method ((Commands2)_application.Commands).AddNamedCommand2(...) to add control to the toolbar.

    So is there any way to add my custom control into the toolbar?


    Best Regards, Carl
    Wednesday, April 13, 2011 5:24 AM

Answers

  • No, VS limits toolbar items to combos, buttons, menus and menu controllers, we don't host arbitrary third party controls.

    Ryan

    Wednesday, April 13, 2011 6:16 AM
  • No, the combo support was removed in Dev10 during the transition to WPF. In AddIns we generally support buttons, menus and menu controllers, I mentioned Combos before but forgot that the population method was removed.

    Ryan

    • Marked as answer by tolily Thursday, April 14, 2011 8:03 AM
    Wednesday, April 13, 2011 7:21 AM

All replies

  • No, VS limits toolbar items to combos, buttons, menus and menu controllers, we don't host arbitrary third party controls.

    Ryan

    Wednesday, April 13, 2011 6:16 AM
  • Very appreciate for your reply.

    I have another quesitons,

    How to add items into combos in toolbar?

    I am using CommandBarControl myControl = (Microsoft.VisualStudio.CommandBars.CommandBarControl)ucCmd.AddControl(addInCmdBar, addInCmdBar.Controls.Count + 1); to add a combobox into my toolbar, but if I try to call ((CommandBarComboBox)myControl).AddItem(***), or ((CommandBarComboBox)myControl).List[1]=*** to add items into my comboBox, I got DeprecatedException.

    Is there any methods available, to add items into combos?


    Best Regards, Carl

    Wednesday, April 13, 2011 6:28 AM
  • No, the combo support was removed in Dev10 during the transition to WPF. In AddIns we generally support buttons, menus and menu controllers, I mentioned Combos before but forgot that the population method was removed.

    Ryan

    • Marked as answer by tolily Thursday, April 14, 2011 8:03 AM
    Wednesday, April 13, 2011 7:21 AM
  • So if I want to add combobox into toolbar in Dev10(Dev10 means Visual Studio 2010, right?), what should I do now?

    Use other techonology such as Extension, or VS Package, instead of implementing IDTExtensibility2? Or something else I can do, any suggestions?


    Best Regards, Carl
    Wednesday, April 13, 2011 9:25 AM
  • Yes you would need to create a package, specify your controls on VSCT and write command handlers for them.

    Ryan

    Wednesday, April 13, 2011 2:14 PM
  • OK, thank you very much.
    Best Regards, Carl
    Thursday, April 14, 2011 8:03 AM