Surround with Tag

Surrounds the selected block with opening and closing tags and activates Linked Identifiers for the tag name. If nothing is selected, the code provider operates the element that currently contains the cursor.

The code provider contains a sub menu, which suggests that the current element be surrounded with one of the following tags.

  • Grid
  • StackPanel
  • Border
  • DockPanel
  • WrapPanel
  • UniformGrid
  • Canvas

Availability

Available from the context menu or via shortcuts:

  • when the cursor is within any element;
  • when a code block is selected.

Notes

  • In a XAML document, if the code provider is applied to a tag with any of the following properties, these properties are moved to the surrounding tag.

    • Canvas.Left
    • Canvas.Top
    • DockPanel.Dock
    • Grid.Column
    • Grid.ColumnSpan
    • Grid.Row
    • Grid.RowSpan

Examples

<img src="D:\Image1.jpg" id="img1" style="width: 100px;" />

Result:

<div><img src="D:\Image1.jpg" id="img1" style="width: 100px;" /></div>

Animation

rsSurroundWithTag

This code provider is the opposite of Remove Tag.