Question

Visual Studio 2008's XAML editor (SP1) cannot reformat the XML into a consistent style.

Which tools can I use to get a nicely formatted XAML file? Studio integration preferred.

Was it helpful?

Solution

Here's a link that is specific to VS2008 XAML formatting but the good news is you can do it directly inside VS.

http://geekswithblogs.net/lbugnion/archive/2007/09/29/Cleaning-up-XAML-code-and-improving-parsing-time-with-Blend.aspx

OTHER TIPS

While browsing through the options, I found that I had to set "Position each attribute on a separate line" and "Position first attribute on same line as start tag" under "Tools > Options ... > Text-Editor > XAML > Formatting > Spacing" and reset the Keyboard mappings under "Tools > Options ... > Environment > Keyboard" to "Visual C# 2005".

Now the XAML editor reformats the XAML to my taste when pressing Ctrl+E, D.

Have you tried CTRL K, D?

Karl just released v2 of his XAML Power toys and it can reformat your xaml from VS2008! Check out the video about XAML Power Toys Accessories

http://karlshifflett.wordpress.com/2008/09/16/xaml-power-toys-v2-release-finally-code-name-hawaii/

Or try xaml styler hosted at http://xamlstyler.codeplex.com/ for visual studio 2010. If you ever used Kaxaml's Xaml Scrubber and you like it, then you could think of this extension is the "Xaml Scrubber" for Visual Studio.

Check http://xamlstyler.codeplex.com/ for feature highlights.

The only tool I found is Kaxaml, which does nice formatting ("XAML Scrubber" entry in the left menu), but being a stand-alone editor doesn't quite make the cut.

http://www.dimebrain.com/2008/05/automating-read.html is a nice plugin for formatting your xaml so the attributes line up underneath each other.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top