Reputation: 1326
I am trying to add two context menus to an Office addin for Powerpoint. The first appears when the user right clicks on a slide, and the second when the user right clicks on a selected shape. They work separately, here is the Ribbon xml:
<contextMenus>
<contextMenu idMso="ContextMenuShape">
<button id=".../>
</contextMenu>
</contextMenus>
and:
<contextMenus>
<contextMenu idMso="ContextMenuFrame">
<button id=.../>
</contextMenu>
<contextMenus>
But when I try to have both, either by nesting both contextMenu elements within the contextMenus element, or having two separate contextMenus elements neither show. Is there any way of doing this or must I have only one contextMenu?
Upvotes: 2
Views: 632
Reputation: 6912
<contextMenus>
element is the container for <contextMenu>
items. In your ribbon.xml you need to put all your context menu items into "contectMenus" container. For example:
<contextMenus>
<contextMenu idMso="ContextMenuShape">
<button id="id_shape" label="Label 1"/>
</contextMenu>
<contextMenu idMso="ContextMenuFrame">
<button id="id_ffame" label="Label 2"/>
</contextMenu>
</contextMenus>
To customize visibility of your contextual items you need to use "GetVisible" and "GetEnabled" handlers of the elements inside each contextual menu; in the example those are buttons.
Upvotes: 2