Reputation: 1229
Is there a way to have a ToolStripMenuItem not closing when I click a child control (in its DropDrowItems Collection)?
In my case, I have some ToolStripMenuItems that work as a check box. Actually, I implemented a radio behavior in some ToolStripMenuItems using their Check property. But I don't want the menu closing when I click any of them, because they aren't an action, they represent just options in the menu item.
Is that possible?
Upvotes: 3
Views: 3096
Reputation: 1
Just for your information:
Upvotes: 0
Reputation: 2513
this.menuItem.DropDown.Closing += new ToolStripDropDownClosingEventHandler(DropDown_Closing);
void DropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
{
if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
{
e.Cancel = true;
((ToolStripDropDownMenu) sender).Invalidate();
}
}
Upvotes: 4