How to make visual studio for mac xaml formatter auto self close tags

62 views Asked by At

for example this code

<Button
    Text="Go Back"
    BackgroundColor="#2196F3"
    TextColor="{StaticResource TextColor}"
    CornerRadius="5"
    Clicked="OnGoBackClicked"
    Padding="10,5"
    Margin="10,0,10,10"></Button>

format to:

<Button
    Text="Go Back"
    BackgroundColor="#2196F3"
    TextColor="{StaticResource TextColor}"
    CornerRadius="5"
    Clicked="OnGoBackClicked"
    Padding="10,5"
    Margin="10,0,10,10" />

now when i press ^I (Control + I) it does not do that maybe im missing some setting thanks for any help

1

There are 1 answers

1
AVTUNEY On
  1. Click on Visual Studio > Preferences in the menu bar.
  2. In the Preferences dialog box, navigate to Source Code > Code Formatting > XAML.
  3. Under the "Formatting Style" section, select "Custom" from the drop-down menu.
  4. Check the box labeled "Self-closing tags" under the "Markup" section.
  5. Click "OK" to save the changes.