5

While working with ASP.NET using Visual Studio (2008) I have discomfort issue: source code editor context menu has only item 'View Designer' but nothing about to view markup quickly!

To see it you need to open Designer and click Markup label in the bottom of a window. Or use Shift+F7 hot key (by default).

So I want to add an item menu 'View Markup' in additional to 'View Designer'. I guess I have to use a Visual Studio add-in if it already exists or write it by myself.

What do you think about that? Is it possible? Or is some solution already exists?

4 Answers 4

10

Tools > Options > Keyboard

Search for View.ToggleDesigner in "Show Commands Containing".

Add new shortcut to Global/Editor with F7.

This works without needing a macro for VS2008/2010

1
  • That is great! I mapped CTRL+SHIFT+UP ARROW to this one and CTRL+SHIFT+DOWN ARROW to the OtherContextMenus.Context.ViewCode command. Now I can switch freely between the views.
    – bbrown
    Sep 20, 2010 at 22:43
4

When you are in code view and would like to see markup view there is no Keyboard shortcut for that. Here is what worked for me:

http://www.karpach.com/Visual-Studio-F7-View-Source.htm

1
  • +1 I never use designer, so this works better for me than ToggleDesigner. I map the macro to Shift+F7 so that the native (and ever-so-slightly faster) "View Code" stays mapped to F7.
    – trebormf
    Apr 20, 2012 at 20:18
1

If you right click the file in "Solution Explorer" you get a "View Markup" option.

3
  • Using Solution Explorer only isn't comfort. It's more quick to use a context menu in additional, imho of course. Feb 16, 2009 at 22:09
  • 1
    I agree, but without writing your own add-in or finding one already written, it's kind of the only option.
    – Micah
    Feb 17, 2009 at 1:56
  • Its hard to believe that Visual Studio 2010 includes a View.ToggleDesigner command that can be assigned to a keyboard shortcut and there is no corresponding View.ToggleMarkup command that can be assigned. Why did this happen I wonder?
    – John Grant
    Feb 11, 2011 at 18:34
1

Generally, to add a command to the context menus you'd do the following:

Tools | Customize

On the "Toolbars" tab put a tick next to the "Context Menus" item - this will add a new toolbar to your IDE, with buttons for Editor Context Menus, Class View Context Menus, Debugger Context Menus, etc

Then switch to the "Commands" tab, select the command you want, and drag it to the appropriate menu, and you're done - in this case in the left hand pane select "View", and then in the right hand pane, scroll down until you get to "View Markup".

That being said, in this instance, I can add the button to the context menu for the code editor, but it's greyed out, and unusable - I guess it needs some context that it gets from the Solution Explorer that it doesn't get from the Code window - which is odd, because it's pulling the same details through for "View Designer" and "View Code".

I guess I'd use Shift+F7 then, sorry about that.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.