'How to populate vsct combo outside idCommandList command?

I am developing an extension for Visual Studio 2022 and I have two vsct combos of type DynamicCombo added in my extension's toolbar:

<Combos>
   <Combo guid="guidPackageCmdSet" id="comboA" priority="0x0012" type="DynamicCombo" defaultWidth="240" idCommandList="comboAGetList">
       <Parent guid="guidPackageCmdSet" id="TWToolbarGroup"/>
       <CommandFlag>IconAndText</CommandFlag>
       <CommandFlag>CommandWellOnly</CommandFlag>
       <Strings>
           <ButtonText>Combo A: </ButtonText>
       </Strings>
   </Combo>
   <Combo guid="guidPackageCmdSet" id="comboB" priority="0x0013" type="DynamicCombo" defaultWidth="240" idCommandList="comboBGetList">
       <Parent guid="guidPackageCmdSet" id="TWToolbarGroup"/>
       <CommandFlag>IconAndText</CommandFlag>
       <CommandFlag>CommandWellOnly</CommandFlag>
       <Strings>
           <ButtonText>Combo B: </ButtonText>
       </Strings>
   </Combo>
<Combos>

I've created two commands for each combobox to load values and handle the on change event.

  1. Is there any way to populate the comboB after changing the value on comboA? I need to populate the comboB based on the value chosen in comboA. Is that possible?

  2. Is it possible to load these combos with an array of my objects? I would need to display a NAME but when I change the value, I need its ID.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source