1
Reply

Toolbar with context menu dropdown / problem when setting autoclose to false

Jonas Pettersson

Jonas Pettersson

Oct 5 2010 5:49 AM
17.1k

Hi,

I have  a ToolStrip control with a dropdown item which opens (via DropDown property) a ContextMenuStrip that has the AutoClose property set to false.

The reason for doing this is that this menu (toolbar dropdown) has a number of display settings, show flags that you typically check/uncheck several after each other until you have found a display state that matches whatever you want to do.

Without the autoclose property set to true I would have to click the toolbar button again, select/deselect a flag and then start over, maybe 5 to 10 times before I'm happy with how the checked toolbar items are setup.

With the autoclose property set to false, clicking the display flags that you want is quick and painless.

Well, that is except for the fact that when doing this, the ContextMenuStrip never closes. Clicking outside of the menu doesn't close it, nor does clicking anywhere on the toolbar including the dropdown button that once displayed the ContextMenuStrip.

Any tips on how to get around this? I want the ContextMenuStrip to stay opened as long as I click on any of the items on it but it should be closed when clicking outside / oin another toolbar top level item just like the toolbar usually behaves.


Answers (1)