I have a ToolStrip that has various drop down menus (ToolStripDropDownButtons). Several of these menus are dynamic - the items are added and removed programmatically, depending on actions the user has performed elsewhere (like the MRU files listing at the bottom of a File menu).
I'd like to offer a simple way for a user to remove a menu item from a menu. To do this, I would like to be able to associate a ContextMenuStrip to some of these menus, which would have a "Delete" or "Remove", that, when selected, would remove the menu item.
You can see similar behavior in the Windows Start Menu. If you go to Start/Programs, you can right-click on any menu item and get a context menu to open, delete, or rename the selected menu item.
Unfortunately, ToolStripDropDownButton is not derived from Windows.Forms.Control, so it does not have a ContextMenuStrip property. I attempted to add a ContextMenuStrip to the parent ToolStrip, but it only affects the tool strip and its top-level menu items - right-clicking on submenus does not invoke the context menu.
I've also tried overriding the MouseUp event on individual menu items, handling the right-click and just bringing up the context menu manually, but this results in original menu closing - which isn't very helpful to a user who wants to double-check that he/she is removing the correct menu
View Complete Post