views:

193

answers:

1

I am using the ToolStripDropDown to host the user control as the pop-up window. The problem is when a context menu strip is displayed from within this pop-up window, the pop-up itself closes in the moment the context menu opens. I have tried to subclass the ContextMenuStrip and added WS_EX_NOACTIVATE to CreateParams but nothing changed. First I thought that there is no way to do this since it is common behavior but then I tried to put a TextBox class onto the pop-up user control and invoke the Edit control context menu - and the parent pop-up window did not close. What am I missing?

A: 

Had a similary Problem. On my UserControll was a toolstrip. When I pressed the toolsstripdropdownbutton the dropdown was shown but the popup disapeared. The reason was that popup.Autoclose was true. After Setting to false the Popup is not closed any more.

        ToolStripDropDown popup = new ToolStripDropDown();
        popup.AutoClose = false;         //Set to FALSE
        popup.Margin = Padding.Empty;
        popup.Padding = Padding.Empty;
        ToolStripControlHost host = new ToolStripControlHost(userControl1);
        host.Margin = Padding.Empty;
        host.Padding = Padding.Empty;
        popup.Items.Add(host);
        popup.Show(button1, new Point(100,100));
Martin H.