Page 1 of 1

Runtime

Posted: Thu Aug 27, 2015 11:48 pm
by CyborgDE
Hello,

how can I compile a xaml document to javascript on runtime ?
I have my own xaml designer and I want to build the javascript output dynamically.

Regards Uwe

Re: Runtime

Posted: Fri Aug 28, 2015 1:00 am
by JS-Support @Userware
Hello,

At the moment there is no runtime built-in support for turning strings containing XAML code into instances of UI elements. XAML parsing is currently done by the compiler. However, it is possible to dynamically create new instances of UI elements via C# code (such as "border.Child = new Button()" etc) and therefore to programmatically build your Visual Tree via C# at runtime. You can either parse the XAML file by yourself - though this will be made easier when CSHTML5 adds support for XDocument (aka "Linq to Xml") in 2016 - or you can create a simpler file format for the purposes of your UI Designer. To do so, I would recomment defining your own simple serializable classes and use the built-in support for XML Serialization and Deserialization that is already available in the current version of CSHTML5. Support for "XamlReader" on the other hand will more likely come in 12 to 18 months.

Regards,
JS-Support