XAML formatting using Visual Studio 2013

If you, like me, are obsessive about the appearence of your xaml code and spent time to line up properties just the right way, you will be delighted to know that Visual Studio has a number of formatting tricks up its sleave to help you with this task.

One of these features is the ability to break a long XAML Element declaration into multiple lines with each element property automatically placed on a new line. To enable this, you have to do the following:

In Visual Studio, go to Tools -> Options -> Text Editor -> XAML -> Formatting -> Spacing.

In there, you will find an option "Position each attribute on a separate line"

Select this option and click OK.

Xaml Editor Settings

The next time you start creating an element with a large number of attributes, Visual Studio will format it nicely for you!

Happy coding...


  • Share this post on