Runtime

CyborgDE
Posts: 75
Joined: Wed Aug 12, 2015 9:21 pm

Runtime

Postby CyborgDE » Thu Aug 27, 2015 11:48 pm

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

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Runtime

Postby JS-Support @Userware » Fri Aug 28, 2015 1:00 am

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


Return to “General Discussion and Other”

Who is online

Users browsing this forum: No registered users and 25 guests