Add Menu to Ribbon Tab

Oct 29, 2013 at 7:32 PM
Edited Oct 29, 2013 at 8:01 PM
Hi,

I need to add a menu to the Add-In Ribbon Tab. I see that there is a menu item, but cannot determine how to enable it or how to set the actions for when an item is selected. I have this information in the .dna file for my add-in. What is the correct approach to implement a menu on the Ribbon tab?
  <CustomUI>
    <!-- Inside here is the exact RibbonX xml passed to Excel -->
    <!-- This will only be loaded for Excel 2010 because of the namespace -->
    <customUI onLoad="XLLRibbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group id="xllGroup" label="Menu Commands">
              <menu id="mTest" label="TOP">
                <menu id="topInfo" label="Information"/>
                <menu id="topAbout" label="About" />
              </menu>
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
  </CustomUI>
EDIT 1:

I found that the menu is a ribbon menu and that buttons are placed within the menu. Once the buttons are placed within the menu, the menu is active.
Marked as answer by lzeitz on 10/29/2013 at 1:01 PM
Oct 29, 2013 at 8:41 PM
Edited Oct 29, 2013 at 8:41 PM
Here is a snippet from an Excel DNA addin's .dna file.
  <CustomUI>
    <customUI xmlns='http://schemas.microsoft.com/office/2006/01/customui' loadImage='LoadImage' onLoad='OnLoadEvent'>
      <ribbon>
        <tabs>
          <tab id='tabAddin' label='My Addin'>
            <group id='grpMyAddin' label='My Addin'>
              <button id='btnConnect' label='Connect' size='large' image='Play' onAction='OnConnectRibbonEvent' getEnabled='GetIsConnectEnabled'/>
            </group >
          </tab>
        </tabs>
      </ribbon>
    </customUI>
  </CustomUI>
In your .NET View class that extends ExcelRibbon you will need to implement several methods:
        public override object LoadImage(string imageId)
        public void OnLoadEvent(IRibbonUI _ribbon)
        public void OnConnectRibbonEvent(IRibbonControl rc)
        public bool GetIsConnectEnabled(IRibbonControl rc)
As your model and controller's state changes, the ribbon button's enabled state (via GetIsConnectEnabled) can change. Hope this helps.

-BT-