Auto formatting the XAML


This fork has been created to have support for Visual Studio 2013 and future versions for this great plugin -


In case mentioned tools doesn't suit you, you can implement your own extension for xaml formatting and following post is a good starting point -

XAML Organizer


Recently, I came across a new Visual Studio 2010 Extension for formatting the XAML -

"XAML Markup Styler" is a xaml beautifer, which makes XAML markup source code beautify much easier by sorting the attributes based on their importance.

This tool can help you/your team maintain a better XAML coding style as well as a much better XAML readability.

Original Post:

Formatting XAML manually is very painful work and if you are used to read neatly formatted markup/code then it becomes impossible to go through other developers code. To solve this problem we thought to use Dimebrain Markup Tamer to auto format code and maintain consistency/readability; but we were not satisfied with this. Recently I found that VS itself provides very good support for formatting(auto) XAML. You just need to set few settings and that's it, you can easily format your XAML by using one shortcut and moreover if you copy paste the code VS automatically formats it. To achieve this go to

Tools->Options->Text Editor->XAML->Formatting

and modify the settings as per your preference. Now you just need to press Ctrl + k, Ctrl + D(Format Document) to format the full document.

I prefer using following settings -



One attribute I would like to talk about is “Position first attribute on same line as start tag”, I prefer not to use it, primarily because it doesn’t align all markup properly:

Formatting with “Position first attribute on same line as start tag” checked:


Formatting with “Position first attribute on same line as start tag” un-checked:



Add a Comment

As it will appear on the website

Not displayed

Your website