3.2 Context Menu

The following shows an example of a context menu customization.

 <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
     <contextMenu idMso="ContextMenuText">
       <control idMso="Cut"
                visible="false" />
       <control idMso="Copy"
                visible="false" />
       <button id="customButton"
               label="Click Me"
               onAction="OnButtonClicked" />    
       <toggleButton id="customToggleButton"
                     label="Toggle Me"
                     onAction="OnButtonToggled" />    

This example customizes the built-in context menu with identifier ContextMenuText. It hides the two built-in controls with identifiers "Cut" and "Copy". It also adds a button and a toggle button with labels Click Me and Toggle Me, respectively. The icons for these controls are loaded by using the LoadCustomImage callback function. The OnButtonClicked callback function is called when the button control is invoked, and the OnButtonToggled callback function is called when the toggle button is switched.