I'm trying to create a custom visual studio extension. It involves a toolbar, with a combo element, which I want to populate programatically.
I made the toolbar and combo box in the vsct, but I'm not sure how to get a reference to it in the code and add items to it.
I have this, where do I go from here?
CommandID commandId = new CommandID(GuidList.guidExtensionCmdSet, (int) PkgCmdIDList.cmdMyDropdown);
Assuming that cmdMyDropdown is the commandId for your dropdown, you then need to create an OleMenuCommand and add it to the OleMenyCommandService.
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
CommandID commandId = new CommandID(GuidList.guidExtensionCmdSet, (int) PkgCmdIDList.cmdMyDropdown);
OleMenuCommand menuMyDynamicComboCommand = new OleMenuCommand(new EventHandler(OnMenuWorkorderDropdown), commandId);
mcs.AddCommand(menuMyDynamicComboCommand);
In your event, you then have to use
Marshal.GetNativeVariantForObject(String[] yourValues, OleMenuCmdEventArgs.OutValue);
OutValue is the dropdown reference that gets passed.
Read more here: http://dotneteers.net/blogs/divedeeper/archive/2008/07/14/LearnVSXNowPart25.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With