…more Visual Studio shortcuts
Bumped into some shortcut keys while playing with Silverlight.
I was on the .xaml page and I pointed my mouse over the ‘<Rectangle’ tag while pressing the Control key (now why did I have the control key pressed? cos my 6th (non)sense said so).
Hey wait a minute, what’s that blue underline? Turns out if you control click a tag or it’s property, it’ll take you to the definition of the tag or the property in the Object Browser. So ctrl+click on a rectangle opens the Object Browser showing the Rectangle objects definition and ctrl+click on ‘Height’ property shows the FrameworkElement.Height definition.
To take it one more step, I added MouseLeftButtonUp event on the rectangle:
MouseLeftButtonUp="myRectangle_MouseLeftButtonUp"
Now, if I ctrl+click on ‘myRectangle_MouseLeftButtonUp’, VS takes me to the code-behind of the event. Of course, you can get to this by right clicking on the event and selecting ‘Navigate to Event Handler’, but ctrl+click is soo much easier!!
Just to add a couple more:
Pressing function key ‘F7’ can toggle between the design and code-behind pages (this works in Win Forms, Web Forms and XAML pages).
In the code-behind page, pressing ctrl+M, ctrl+O collapses all the ‘code-blocks’, ctrl+M, ctrl+P opens up all of them. Once you’ve collapsed all the code-blocks, you can do ctrl+M, ctrl+M to open up only the block that the cursor is on. (I’m not sure if this is a VS shortcut, or if it was added by Resharper).