Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That's always annoyed me too. One option is to create a simple macro.</p> <ol> <li>Type your XAML tag and name it. (At this point your cursor is inside the quotation marks of the attribute.)</li> <li>Press <kbd>Ctrl-Shift-R</kbd> to start macro recording.</li> <li>Press <kbd>End</kbd>, and then <kbd>Enter</kbd>. (Now your cursor is where you want it to be.)</li> <li>Press <kbd>Ctrl-Shift-R</kbd> again to stop macro recording.</li> </ol> <p>If you follow the steps above, Visual Studio will have generated the following macro code, which you can see if you press <kbd>Alt-F8</kbd> and open RecordingModule.TemporaryMacro:</p> <pre><code>DTE.ActiveDocument.Selection.EndOfLine() DTE.ActiveDocument.Selection.NewLine() </code></pre> <p>You can now run this macro with <kbd>Ctrl-Shift-P</kbd>, but it's only a temporary macro at this point. You should save it and assign it to a keyboard shortcut.</p> <ol> <li>Open Macro Explorer (<kbd>Alt-F8</kbd>).</li> <li>Find TemporaryMacro under MyMacros | RecordingModule, and rename it. Maybe even move it out of RecordingModule to a different module too.</li> <li>Open the Tools menu and go to Options, Environment, Keyboard.</li> <li>Type the name of your macro under "Show commands containing".</li> <li>Select your macro and assign it shortcut key(s). (I chose <kbd>Ctrl-Enter</kbd>.)</li> </ol> <p>So now, instead of moving your hand to press <kbd>End</kbd> and then <kbd>Enter</kbd>, you can just press <kbd>Ctrl-Enter</kbd>.</p> <p>I also recorded another macro that moves to the end of the line and types " />" for me, and attached that to <kbd>Ctrl-/</kbd>. The code VS generates looks like this:</p> <pre><code>DTE.ActiveDocument.Selection.EndOfLine() DTE.ActiveDocument.Selection.Text = " /&gt;" DTE.ActiveDocument.Selection.NewLine() </code></pre> <p>An alternative to all these macros is to turn off the automatic quotes. Open the Tools menu and go to Options, Text Editor, XAML, Miscellaneous. Uncheck the option for auto-inserting attribute quotes. Then it won't add the ending quote for you, and you won't have to use the <kbd>arrow keys</kbd> or the <kbd>End</kbd> key (although you will have to type the ending quote now, of course).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload