Shortcut for switching between markup and code

Using Visual Studio 2008 Team Edition, is it possible to assign a keyboard shortcut that switches between markup and code? If not, is it possible to assign a key combination that moves from code to markup?

+3
source share
2 answers

Below is a macro taken from Lozza's comment at http://www.codinghorror.com/blog/archives/000315.html . You just need to bind it to the shortcut of your choice:

Sub SwitchToMarkup()
  Dim FileName

  If (DTE.ActiveWindow.Caption().EndsWith(".cs")) Then
    ' swith from .aspx.cs to .aspx
    FileName = DTE.ActiveWindow.Document.FullName.Replace(".cs", "")
    If System.IO.File.Exists(FileName) Then
      DTE.ItemOperations.OpenFile(FileName)
    End If
  ElseIf (DTE.ActiveWindow.Caption().EndsWith(".aspx")) Then
    ' swith from .aspx to .aspx.cs
    FileName = DTE.ActiveWindow.Document.FullName.Replace(".aspx", ".aspx.cs")
    If System.IO.File.Exists(FileName) Then
      DTE.ItemOperations.OpenFile(FileName)
    End If
  ElseIf (DTE.ActiveWindow.Caption().EndsWith(".ascx")) Then
    FileName = DTE.ActiveWindow.Document.FullName.Replace(".ascx", ".ascx.cs")
    If System.IO.File.Exists(FileName) Then
      DTE.ItemOperations.OpenFile(FileName)
    End If
  End If
End Sub
+4
source

, , , ASPX, F7 (show code) Shift-F7 (show designer) ? VS2008 ( WinForms), # , .

+1

Source: https://habr.com/ru/post/1697369/


All Articles