I have a context menu strip with 8 items and two separators. When the user brings up the context menu strip, then hits the arrow key to scroll through the items, hitting the eighth item causes the menu to 'scroll' up, leaving blank space at the bottom. Is there any way to prevent that behaviour?
-
Is this in a WPF or WinForms app? – Dan McClain May 13 '09 at 16:50
-
Sorry, this is in a WinForms app. .NET 2.0, Visual Studio 2005, on windows XP. – genki May 13 '09 at 20:39
2 Answers
I found it. It turns out that if you have items in the menu that are not visible, it screws with the spacing. The fix was to change the logic to actually remove/add items or rebuild the menu rather than toggling menu item visibility. This is one case where toggling 'Visible' had some odd behaviour.
I posted this as an answer because I wanted to add images to the posting. I am seeing the same behavior, and I think it is a flaw in the drop-down context menu itself.
Here is what is happening:
(source: googlepages.com)
(source: googlepages.com)
It only occurs when a user goes down the context menu with the keyboard. It is as if it is attempting to do some kind of scrolling, because if you keep doing down the list, the selection resets at the top.

- 21,988
- 13
- 81
- 109

- 11,143
- 1
- 38
- 72
-
What OS ver. do you use? I just tried your issue on vista and it doesn't occur. If you use vista, please post the code and will test it, maybe I can help. – Shimmy Weitzhandler May 13 '09 at 17:41
-
Yes, that's exactly what I'm seeing with my right-click context menus. It really does seem like a flaw in the menu itself, I couldn't find anything that would allow me to change that functionality in the documentation. Perhaps if I had time, I could dig in with a reflector and figure out how to override that behaviour... – genki May 13 '09 at 20:40
-
Well this is the strange thing. This behavior only happens on that Reports drop-down in my app.. All the other dropdowns are fine. – jgallant May 14 '09 at 10:31
-
I think it might have a minimum number of items requirement. I'll check to see if any other of my menus have this behaviour. – genki May 14 '09 at 18:42