Visual Studio 2022 Support Here
Update: June 14th, 2012 - I uploaded a new version that will work with Visual Studio 2012. If you have problems upgrading, uninstall the previous version and it should work without issue.
The key principle behind the formatter is that it only concerns itself with indentation, not what should be on any given line. Visual Studio does offer some options in this regard but the closest thing I could get to what I wanted meant that when I formatted, a typical style Setter was 2 or 3 lines. Multiplying the size of a style by 2 or 3 times makes for a rather large XAML file, not ideal. So you worry about what goes on what line, and I’ll take care of making it all nicely aligned.
Child properties are aligned under the first property of a tag, if there is none, it indents 4 spaces (or whatever you have set your default to in Visual Studio).
Usage: The command is located in the Tools menu, it is titled 'Format XAML'. There is no default command binding set, you will have to set your own.
Updates: v.1.99.2 - Removed VS2022 support. See the new extension for VS2022 support
v.1.99.1 - Added support for VS2022 Preview (and might have stopped support for anything before VS2015, not 100% sure)
v.1.99 - Handle <?xml tags
v1.94 - Removed Visual Studio MPF 12.0 dependency.
v1.93 - Fixed a small bug with comment handling.
v1.9 - Better support for VS2010 and VS2012. Fixed a problem with an indent size that is not 4.
v1.6 - Visual Studio 2012 support.
v1.4 - Better TFS support by removing the pre-check for a readonly file (Thanks to g_breeze for the feedback).
v1.3 - Added some fixes for comments, mostly issues with multi-line comments.
v1.2 - Added better support for comments.
Would love to hear feedback if you have any, @DannOh on twitter or email me at XamlFormatter@danno.ca
A quick sample, with some misaligned propreties and tags that are not fully indented.
More information can be found at http://www.danno.ca/XamlFormatter