Visual Studio hotkey to switch between code behind and source file?

Viewed 56649

I use the Shift + F7 often to switch between source and design view.

Does anyone know of a hotkey to switch between the source file and its code behind file, e.g. between (Default.aspx and Default.aspx.cs)?

9 Answers

Yep just F7

Look at this poster for C# VS2008 shortcuts

You can also bind it to any combination of keys you like, go to tools, options (show all settings) environment, keybord, Show Commands for View.ViewCode and change to your liking.

Added by Rob Cooper:

For 2005 Users: Visual C# 2005 Keyboard Shortcut Reference Poster

For 2010 Users: Visual C# 2010 Keyboard Shortcut Reference Poster

Edit 08 Sept 2014

There don't seem to be posters beyond 2010 but there is a website for VS2012, VS2013 and VS14: Visual Studio Shortcuts

For those trying to do this (switch from the code view to markup view) in VS2012, I had to go Tools > Options > Keyboard, then select

  • Keyboard Mapping Scheme as "(default)"
  • View.ToggleDesigner as the command
  • Use new shortcut in "Text Editor"
  • Set the shortcut key to F7

This results in F7 switching both ways from the markup view to the code view and vice versa.

Before doing this I had to use Shift+F7 twice to get to markup from the code view.

When in code view use shift-F7 to get to the designer. When in the designer use F7 to get back to code.

Try Ctrl + PageUp to toggle between design view and code behind.

Related