Emad Gabriel
Emad Gabriel

Reputation: 3707

Transform XAML syntax from Shorthand to full syntax

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

Upvotes: 0

Views: 512

Answers (2)

Martin Randall
Martin Randall

Reputation: 746

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

Upvotes: 0

Dave Jarvis
Dave Jarvis

Reputation: 31161

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/

Upvotes: 0

Related Questions