If I create a menu with two items (say "Item1" and "Item2" and then create two subitems under each one (1A, 1B, 2A and 2B), and then disable Item1, I'd expect that 1A and 1B wouldn't show.
And, indeed, if I move onto Item1 they don't. Unless I then move on to Item2, wait for 2A and 2B to show, and then move back to Item1. At which point 1A and 1B both pop up, fully active.
Is this a known bug? Is it something I can work around? Any suggestions?
The users want to be able to see the things that are currently disabled, or I'd just make things invisible. Sadly, this isn't an option we can easily use.
I've faced the same problem and would like to add a few words to the answer. You would probably want to implement workaroud mentioned by Chris Taylor in a separate control inherited from menu item, and make a unit test. In this case you would need to use Available property instead of Visible. Here is the quote from the http://blog.excastle.com/2008/12/28/fixing-menustrip-part-2-visible-vs-available-and-a-repro-case/
Regards,
Max
I can confirm that this occurs with the MenuStrip for Framework 2.0, 3.5 and 4.0. The only reasonable workaround that I have is to set the
Visible
property tofalse
, so the item does not appear at all. Not Ideal, but better than having the sub-items accessible.Of course you can also create a function that will recursively disable all child items, that way even if they appear, they are at least disabled, you will need to maintain the previous state to ensure that you do not later re-enable a child item that is actually inteded to be disabled etc. The documentation indicates that this is actually what happens, but that is not the case, sub-items remain enabled even when the parent item is disabled.