Sign in to follow this  

[.net] The Members and Types dropdowns in VS.NET

This topic is 4184 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I also posted this on my blog, but I thought there might be some interest here as well, so I'm reposting: The code editor window in VS.NET has two dropdowns on top, one containing the types present in the current file and the other containing the members present in that file. This is a pretty good idea, and makes it easy to navigate through a code file. However, I found that I never really used it all that much. I’m not all that big on having to use the mouse to navigate in VS.NET in the first place, and it was usually faster to just search through the file either manually with arrow keys and PgUp/PgDwn (using the Eyeball Mk I feature shipped with most Visual Studio users) or with incremental search (Ctrl+I). It seems that the main trouble with those two dropdowns is that they’re not easily accessible through the keyboard. There is no built-in VS command that drops them down. However, you can set the focus on the navigation bar by pressing Ctrl-F2. That’ll leave the Types dropdown focused, so you can use Down Arrow to navigate it, or press TAB to get to the Members dropdown. This means that if you want to use the Members dropdown to navigate to another member in the current class, you have to do Ctrl-F2 + TAB + Down Arrow before you can start selecting the member you want. For me, this is too much (and Ctrl-F2 is a very awkward key combination as well unless you have very big hands or use both hands to press it). The lack of a decent key binding for those two dropdowns kept annoying me to the point where I decided to do something about it. So I wrote a small VS addin that adds two new commands to Visual Studio, one to drop down the Types combo and one to drop down the Members combo. It also sets focus on the dropdowns, so you can navigate right away using arrow keys and/or the first letter in the member you’re looking for. When starting up for the first time, the addin will ask you if it should install key bindings for the two commands, Ctrl-D, Ctrl-P (for tyPes) and Ctrl-D, Ctrl-M (for Members). I considered Ctrl-D, Ctrl-T for the Types one, but it felt a lot more awkward to use, so I settled on the current choice. You can of course remap the key bindings for the commands yourself using the Keyboard options page under Tools->Options. The commands are named “MemberDropDown.DropDownMembers” and “MemberDropDown.DropDownTypes”. The addin will presently only work for Visual Studio 2005, however, I might consider making it work for all VSes if there’s interest. You can find an MSI installer here and the source is in a Subversion repository here.

Share this post


Link to post
Share on other sites

This topic is 4184 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this