Geeks With Blogs
Sergey Popov's Blog
| Home |

As a software developer, I spend a lot of time using Visual Studio. I have to say that I completely satisfied with Visual Studio generally. Nevertheless, sometimes Visual Studio starts annoying me. One issue which poisoned my existence for a long time is that context menu behavior in VS2010 is a little different than it was in VS2005/2008. Unfortunately, in VS2012 this behavior remains the same as in VS2010.

So, what is the issue? Working with Visual Studio, I use the keyboard in most cases. I also use the Apps key on the keyboard to open context menus in the code editor. Moreover, long time ago I am got used to using some key sequences, and press the keys without even thinking.

In VS2008, a mouse pointer position didn’t affect context menu navigation if I used the keyboard. Every time I opened a context menu I was sure that, for example, the "Apps, Down, Down, Enter, Up, Enter" key sequence always invoke "Organize Usings > Remove and Sort" function.


But in VS2010, this behavior has been changed. If a mouse pointer is located over an opened context menu, the menu item under the mouse pointer becomes selected immediately! So, now the "Apps, Down, Down, Enter, Up, Enter" key sequence will not lead to expected results all the time.

In some cases, the result may be a little scary. If you are using Visual SVN extension, this key sequence may invoke "Revert whole file" function.


Of course, this is not a fatal problem because "Undo" function restores all the changes, but this behavior strongly annoys me.

In Visual Studio 2012, context menu behavior is a little different than in VS2010, but a mouse pointer position still affects the keyboard navigation in the context menu, and this behavior is still annoying.

I tried to find the way how to change this behavior, but I didn’t manage to find the answer quickly. Then I decided to go right though, so I wrote a small utility which fixes this issue. This utility watches for Apps key, and if the key is pressed in Visual Studio, the utility moves the mouse pointer to the top of the screen before opening the context menu.

You can find binaries and the source code of this utility here:

This utility works fine in Windows 7 and Windows 8 x64. I wrote the first version in January, 2011; now I just added Visual Studio 2012 support.

I hope you will find this utility useful! :)

Posted on Sunday, November 4, 2012 5:49 PM | Back to top

Comments on this post: Visual Studio 2010/2012 Context Menus and a Keyboard

# re: Visual Studio 2010/2012 Context Menus and a Keyboard
Requesting Gravatar...
You could always just use the alt key. :p
Left by herpderp on Nov 06, 2012 9:35 AM

# re: Visual Studio 2010/2012 Context Menus and a Keyboard
Requesting Gravatar...
Yes, but it's very hard to get rid of old habits :)
Left by Sergey Popov on Nov 06, 2012 8:43 PM

# re: Visual Studio 2010/2012 Context Menus and a Keyboard
Requesting Gravatar...

I've been complaining about this ever since it appeared in VS 2010, and it keeps messing me up.

Your program will save me a lot of frustration and mistakes, so again, THANK YOU!!!

In case you're interested, I've had to modify your application for my setup because I'm using a multi-monitor environment where the primary screen is positioned lower than the screen with VS, meaning that at Y-position (1) the cursor is in the middle of the VS window!! But I took a shortcut to resolve and simply hard-coded the cursor position to (1,1).

Making this change would not have been possible if you didn't make your source code available, so thank you for sharing your source code!!

Left by David P on Sep 02, 2013 2:49 AM

Your comment:
 (will show your gravatar)

Copyright © Sergey Popov | Powered by: