Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Ribbon Tech Support » Disable automatic context menu Collapse All
Subject Author Date
Brandon Frye Sep 26, 2008 - 4:41 PM

I wold lke to put my own context menus together for the ribbon. The default context menu seems to take over everything... Can I turn it off?



Brandon Frye Oct 8, 2008 - 1:13 PM

WooHoo!! Gotta love reflection!

Thanks, works exactly as needed.

Brandon Frye Oct 7, 2008 - 6:35 PM

I am still having trouble with this.

I have a standard windows ContextMenuStrip context menu associated with a control on the ribbon (from within a drop down). When I activate the context menu I actually get both the standard ribbbon context menu, and the windows context menu. I don’t want to use the ribbon context menu because the content of the ribbon drop down is a plugin. And I don’t want to have to require plugin writers to have Elegant UI Libraries, nor do I want to go through the trouble of abstracting out menu commands. I would like to just disable the default context menu for the ribbons completely. Can I do this?



Technical Support Oct 8, 2008 - 9:20 AM

The option you are looking for is not available through the public Elegant Ribbon program interface but we will add it in the next release. At the moment you can achieve this by using the following code:

InitializeComponent();     // Form initialization

// This code irreparably turns off default ribbon context menu
FieldInfo fi = ribbon1.GetType().GetField("_ContextMenuManager", BindingFlags.Instance | BindingFlags.NonPublic);
IDisposable disp = fi.GetValue(ribbon1) as IDisposable;
if (disp != null)
If you still have any questions, just contact us.

Technical Support Sep 27, 2008 - 5:08 AM

You can assign a custom context menu for any control or modify the default context menu on the fly (use the ContextMenu.ContextMenuShowing event). You can learn more about this from Context Menus.