问题
I often hit F7 when viewing the .aspx page I am working on to get to the code-beind, but sometimes just out of natural habit I hit F7 again (not sure why, but it happens often enough to be frsutrating). Hitting F7 on the code-behind switches to design view for the .aspx which often times takes a while to render.
I already have 'source view' as the default open, but I would like F7 when in the code-behind to swap back to the .aspx source instead of design... is this possible?
回答1:
http://www.codeproject.com/KB/macros/ToggleAspNetCodeBehind.aspx?print=true with the following modifications should be what you need:
**Change the line:**
OpenCodeBehindFile(activeDoc)
to:
OpenCodeBehindFile(activeDoc & ".cs")
**Change the line in OpenCodeBehindFile from:**
projItem.Open(Constants.vsViewKindCode)
to:
projItem.Open(Constants.vsViewKindCode).Activate()
Reference: http://social.msdn.microsoft.com/forums/en-US/csharpide/thread/90ccfd68-c083-49a4-947a-03178d6af288/
回答2:
I have this behavior, and I thought it was this way out of the box, but I do have ReSharper installed. Looking at the keyboard settings my F7 is bound to "View.ViewCode (F7 (Settings Designer))" and "View.ToggleDesigner (F7 (Global))".
来源:https://stackoverflow.com/questions/1208979/disable-design-view-on-code-behind-page