Reputation: 7475
I'm used to press shift+F7 to switch between my code behind and the designer (which takes between 1 and 5 seconds to load) then I always have to click on View Xaml to modify my XAML code.
I don't find any shortcut in Tools/Options/Keyboard to go directly (from code behind to XAML code). How can I do that ?
Upvotes: 32
Views: 11668
Reputation: 1
-->Tools --> Options --> Keyboard Seek "view.view..
View.ViewCode [F7] (global) Assign
View.ViewDesigner [Shif+F7] (global) Assign
Upvotes: 0
Reputation: 517
In VS2008, while in code-behind of your XAML page (.xaml.cs), pressing SHIFT-F7 will take you to the XAML Designer or the XAML code page, depending on which one had the latest focus. Pressing SHIFT-F7 again will take you from the XAML code page to the designer and vice versa.
While in the XAML designer or XAML code page, pressing F7 takes you to the related code behind page.
UPDATE. Applicable for later versions (e.g. MS VS 2015 too).
Upvotes: 26
Reputation: 501
For VS 2012, F7 builds the solution.
Shift-F7: goes from code-behind to XAML Ctrl
Ctrl-Alt-0: goes from XAML to code-behind
It's in the View menu, but not an obvious keystroke. Tools-Customize...Keyboard... to customize it.
Upvotes: 1
Reputation: 504
I've finally found the solution for VS 2010:
F7: switch between Code Behind and XAML (Design or Markup depending on last used)
Shift+F7: switch between XAML (Design) and XAML (Markup).
F7 shortcut mapping should look like "View.ToggleDesigner (F7 (Global))"
Shift+F7 shortcut mapping should look like "View.ViewDesigner (Shift+F7 (Global))" and "View.ViewMarkup (Shift+F7 (HTML Source Editor View))" (two mappings for one shortcut).
Upvotes: 8
Reputation: 41
When I first installed VS2010, my keyboard mappings were set to (Default). The default setting had View.ViewDesigner mapped to "Shift-F7 (HTML Editor Source View)". To get the shortcut to work in all views, I had to change the mapping to "Shift-F7 (Global)". Changing the keyboard mappings to "Visual C# 2005" worked as well.
Upvotes: 4
Reputation: 12216
Download dpack for visual studio (free) - then F7 will always switch to the "other" view. Plenty of other great features in there too.
Upvotes: 0
Reputation: 16129
For VS 2008:
F7 goes from XAML to Code Behind, Shift-F7 goes from Code Behind to XAML
Upvotes: 1