XamlHack: A Better XAMLPad


XamlHack is a little XAML authoring tool which I use in my daily WPF life. whenever I want to author some small pieces of XAML code, I use this tool instead of Visual Studio, becauese this tool is more lightweight and easier to work with when writing some trivial XAML testing code, and the following is some of the features which this version of XamlHack supports:

1. Basic text editing features & syntax highlighting for XAML

Writing a text editor which directly supports syntax highlight is really difficult, fortunately SharpDevelop project already has a decent text editing control, so without reinventing the wheel, I use this control instead, so I can get syntax highlighting, line numbering, folding and unfolding etc at free. I also add the search and replace capability which is essential to any text editor.

2. XAML preview with element tree viewing capability using "Element Tree Explorer"   

In the XAML preview window(aka the "Design" tab shown below), You can examine the definition of the visual tree and logical tree of the root element. I think this feature is very important, since the element tree is a key player in a lot of WPF features for instance resource lookup, property inheritance and routed events etc. By default, the "Element Tree Explorer" is turened off, you can turn it on by checking it from the "View" menu.

3. Examine the default value of DPs using "Property Explorer"

The ability to examine the default value of dependency properties is a vital feature, in particular, when you want to know the default XAML definition for a control's ControlTemplate and Style property, XamlHack has this feature built in, so you don't need to go a long way to use Expression Blend to find out such kind of info, and another plus of this tool is that it enables you to add third party assemblies for examination.

4. Convert BAML to XAML using "Resource Explorer"

I use reflector quite a lot to "reverse engineer" the code written by other poeple, reflector can let you decompile the IL code, but not BAML code, so in order to "reverse engineer" BAML code, I create this tool (at the time of this writing, Reflector already has this feature.)

5. Last but not least, peculiar error warning.

When your XAML code contains some errors, XamlHack will show you a hilarious error warning message in "Design" tab, and when you click the message, it will turn you back to your xaml code, and directly highlight the source of error for you.

If XamlHack and the features it provides make some sense to you, you can download it here and have a try on it, any feedback and suggestions are greatly appreciated.

Attachment: XamlHack.zip