Compile Xaml to C# (.cs)
I recently published XamlT @ http://XamlT.com which is a tool that has several useful functions for xaml users.
1) You can view information about the Types expressible in different Xaml Vocabularies (WPF, SL 1.0, SL 1.1, etc..)
2) You can also convert Xaml files into C#
A little background on Xaml & C#
[you can replace the words C# or .cs below with VB and it is all still true]
In WPF, we compile Xaml into a combination of C# (.g.cs) and a special binary form (.baml). So at runtime, in most cases, there doesn’t need to be any Xml parsing happening – baml is an optimized, pre-tokenized version of the elements that were specified in the .xaml file.
Once a window/page is displayed in WPF, often people programmatically change the state of the tree or add new subtrees to the tree. If people know how to do something in Xaml, it isn’t always simple to know the code to do the same thing.
That is why I built the Xaml -> C# tool into XamlT.
Related posts from the past
- What tools generate .g.cs from XAML? Can it be done at runtime?
- 3 Coding Styles for Avalon Applications (this shows ways that markup and code can be mixed during compile and/or runtime)
- .xaml, .baml, .g.cs details (discusses some details about baml, generated code)