How to place attributes on a single line in XAML

How can I format this XAML statement:

<Label Grid.Column ="1" Content="{Binding Name}" MinWidth="70" VerticalAlignment="Center"/>

to something like this where all attributes are shown on a new line:

<Label Grid.Column ="1"

           Content="{Binding Name}"

            MinWidth="70"

            VerticalAlignment="Center"/>

 

0
3 comments
Official comment

Hello Jeff!

 

Sorry for delay in responding.

Please try setting the following option - ReSharper | Options | Code Editing | XML | Formatting style | Processing instructions | Attributes format to Each attribute on separate line.

As far as XAML inherits its formatting options from XML options it applies to XAML files as well.

Thank you.

I can't get attributes to wrap on separate lines.

In my case, it wraps the selected line to a certain width but leaves some attributes on the same line. This is coming from Formatting Style | Line Wrapping

Also please clarify which command(s) to issue in order to trigger this. I tried Apply Code Style and Reformat Code and got the same results.

Before (All on a single line):

<Ellipse Name="myEllipse" Fill="{TemplateBinding Control.Background}" Width="100" Height="100" Margin="0" Stroke="Black" />

After (Line splits in one place only):

<Ellipse Name="myEllipse" Fill="{TemplateBinding Control.Background}" Width="100"

Height="100" Margin="0" Stroke="Black" />

0

Hello Jeff!

 

Could you please export and  share your dotsettings from all layers (https://www.jetbrains.com/help/resharper/Sharing_Configuration_Options.html#managing). You can do it  using 'Submit a request' form at the top of the page.

Please also provide code sample that should be formatted.

Thank you.

0

Please sign in to leave a comment.