Skip to main content

Break Apart/LineUp Attributes (XAML)

Purpose

This Code Formatter is used to collapse the attributes of a XAML tag into a single line or break them apart.

Availability

Available when the caret is on a XAML tag with two or more attributes.

Usage

  1. Place the caret on a XAML tag with two or more attributes.

    Note

    The blinking cursor shows the caret’s position at which the Code Formatter is available.

    <Window x:Class="DemoApplication.DemoWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="DemoWindow" Height="350" Width="525">
    
  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
  3. Select Break Apart Attributes from the menu (LineUp Attributes if you need to collapse attributes to a single line).

After execution, the Code Formatter removes the line breaks and converts the attributes into a single-line form or expands them to a multiple-line form.

<Window x:Class="DemoApplication.DemoWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="DemoWindow"
        Height="350"
        Width="525">