How to place 'Property' and 'Value' on single line in XAML
How can I format XAML like this:
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#547AFF"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Margin="{TemplateBinding Margin}"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
Each attribute in on single line except ‘Property’ and ‘Value’. They should stay on a single line.
What I get after reformatting is like this:
<Setter Property="Foreground"
Value="White"/>
<Setter Property="Background"
Value="#547AFF"/>
Here Upload id: 2026_02_24_NGK7Fg8DnqCHRPpf2yfHnX (file: Screenshot 2026-02-24 080108.png) are my XML settings.
Please sign in to leave a comment.
Hi Poone Mokariasl !
The XML/XAML formatter only lets you choose one of these global attribute layouts for all XML/XAML tags:
on_single_line- all attributes stay on one linefirst_attribute_on_single_line- first attribute with tag name, all others each on their own line (what you’re seeing)on_different_lines- each attribute on its own linedo_not_touch- don’t reformat attributes at allThere’s no per-attribute or per-element exception mechanism for XAML setters.
So you can either:
on_single_lineto keepPropertyandValuetogether everywhere (but then all attributes will stay on one line), orPropertyandValueacross lines, ordo_not_touchfor XML/XAML attributes and format those tags manually.