Ribbon: Right-Click Context Menu

Nov 5, 2008 at 5:58 AM

Does the Ribbon CTP 1 have the built-in-feature of displaying a ContextMenu when you right-click a button on a Ribbon Tab?

As an example, if you right-click the "Paste" button in Word 2007, you get a ContextMenu with the following options:
- Add to Quick Access Toolbar
- Customize the Quick Access Toolbar...
- Show Quick Access Toolbar Above the Ribbon
- Minimize the Ribbon

This functionality is key to our application, and I am wondering if the functionality exists or whether I need to either implement the feature myself, or choose another Ribbon implementation.

Nov 5, 2008 at 5:41 PM
Hi Brad,

This feature is not built-in to the CTP, but it should be fairly easy to implement yourself.  You would just need to define a ContextMenu with those items and hook up the logic to handle execution of those items, and then assign that ContextMenu to all of your Ribbon controls and groups.  "Show Quick Access Toolbar Above the Ribbon" and "Minimize the Ribbon" are already defined in the CTP under the customize menu of the QuickAccessToolbar, so you could just copy those over from our source code and reuse them.  "Add to Quick Access Toolbar" is pretty simple because you just need to write logic to add a new control of the same type to the QAT, assign the same command to it, and set the Placement property to InToolbar (and make sure that its state is the same as the control on the Ribbon).  "Customize the Quick Access Toolbar" will be the most difficult since you'll need to create the dialog, but this is an optional feature so you could skip if you don't need it.