tags:

views:

140

answers:

2

Is there a tool or a simple way to transform XAML code from the shorthand syntax to the full syntax? For example: moving from something like:

<_TextBox Text="{Binding Path=Formula.Production, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

to

<_TextBox> <_TextBox.Text> <Binding Path="Formula.NumCloses" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"> </Binding> </TextBox.Text> </TextBox>

?

Thanks

A: 

If it is pure XML then you can use XSL and XSLT software to do the transformation.

The XSL transformation would have to parse the Text string value into the desired XML fields. It is possible, but neither simple nor straightforward. It seems strange to mix non-XML structure (the Text attribute value) with XML. I can see why you want to do the transformation (if only to leverage the vast numbers of software tools for handling XML data).

Another possibility is to write a small script (in Python or Java) that reads the XML content for you, then performs the conversion. This will probably be the most flexible solution.

An interesting read about XAML conversion: http://simonwillison.net/2003/Oct/24/microsoftsXUL/

Dave Jarvis
A: 

Try Resharper. It will expand XAML in the manner you want. Take a look at Jet Brains website for more information.

Martin Randall