title: Visual Studio Extension Menu Group Visibility
body: <p>Please go easy on me, I am new to Visual Studio Extension development, but inherited a sizable project. It targets VS2015-2019.</p>
  <p>Within it, I have a menu <strong>group</strong> (not to be confused with menu item). When it is selected it will show the collection of menu items related to it as a sub menu.</p>
  <p>Therefore, this thing groups menu items together and is not invoking a menu command itself, as would be the case for the menu items it contains.</p>
  <p>I need to dynamically show/hide this group by setting the visibility on some sort of test. Despite reading a lot of the related topics here on SO and the MS docs, I cannot find this particular case being mentioned anywhere. Maybe I just didn't get a correct search hit from Google. Anyhow, anything I can find pertaining to visibility is always about a menu item (leaf node in the menu tree) and not actually a menu group.</p>
  <p>As an aside, I had the same requirement for some menu items and I've sorted them out without any problem.</p>
  <p>Here is the somewhat anonymized definition:</p>
  <pre><code>      &lt;Menu guid=&quot;guidMyPackageCmdSet&quot; id=&quot;SubMenu&quot; priority=&quot;0x0007&quot; type=&quot;Menu&quot;&gt;
          &lt;Parent guid=&quot;guidMyPackageCmdSet&quot; id=&quot;MenuGroup&quot; /&gt;
          &lt;Strings&gt;
            &lt;ButtonText&gt;Tool Name&lt;/ButtonText&gt;
            &lt;CommandName&gt;ToolName&lt;/CommandName&gt;
          &lt;/Strings&gt;
        &lt;/Menu&gt;
  </code></pre>
  <p>I tried adding the command flag for dynamic visibility to this and registering a command for <code>SubMenu</code> and placing my test in the <code>BeforeQueryStatus</code>. I also tried the same using <code>MenuGroup</code>.</p>
  <p>Both didn't work.</p>
  <p>How is one meant to control visibility of menu groups? Apologies if there is a really clear doc on this somewhere online - I just haven't located it yet and feel frustrated that such a fundamentally easy thing to conceive, should be any harder for menu groups than it is for menu items. I expected the menu system in a VS extension to be as straight forward as general .NET app development.</p>