For several years, whenever I've needed to include code snippets in my blogs and articles, I've used a neat little application that VBCity member HotDog wrote. This has stood me in good stead until the day that XAML arrived on the scene. Unfortunately, XAML kinda confuses HotDog's AutoFormatter tool and I end up with missing angle brackets.
A bit of searching led me to a tool called CopySourceAsHTML. Although I had seen this used with Visual Studio 2005, there was a minor problem using it with 2008 for a while, but this was easily fixed with a minor tweak.
Now though there is an official Visual Studio 2008 version. The extra good news about this is that it will also copy XAML to HTML.
One thing to watch out for if you have used the tool before and usually right click on a code snippet to copy is as HTML:

you will expect to see the Copy As HTML option in the menu.
However, this doesn't appear in the context menu if you right click on the markup in the XAML Markup Pane. But it is available and all you have to do is go to the IDE main menu, select Edit and the Copy As HTML menu item will be available for you there.
This great little utility is written (and updated) by Colin Coller of J T Leigh and Associates. You can download it from here.
Posted
Dec 11 2008, 09:18 AM
by
Admin