Loading XAML documents

mparento
Posts: 2
Joined: Fri Dec 11, 2015 6:04 am

Loading XAML documents

Postby mparento » Fri Dec 11, 2015 6:26 am

Hi,

Could a compiled application read and render XAML at runtime? I guess that it couldn't but, since that subject is of extreme importance to me (and to other people where I work), I ask the question anyway.

We work on a large Silverlight application that allows to edit yearbook page layouts (a kind of Adobe InDesign on the Web) and saves them in XAML format; the XAML content is then processed at our place to produce PDF files that we print. Since the support for Silverlight is about to end, we want to convert the application to HTML5/JS. Your development framework looks interesting; if using it allowed the application to work with XAML documents, it would become the obvious choice for the future development of our application.

Thanks!

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

Re: Loading XAML documents

Postby JS-Support » Fri Dec 11, 2015 7:33 am

Hi mparento and welcome to the forums.

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") sometime in 2016 - or you can create a simpler file format for the purposes of your UI Designer. To do so, I would recommend 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 a year or so.

Thank you.
Regards.
JS-Support

mparento
Posts: 2
Joined: Fri Dec 11, 2015 6:04 am

Re: Loading XAML documents

Postby mparento » Fri Dec 11, 2015 8:30 am

OK, thanks for the info. I will consider your suggestion of creating a simple format. Or I will wait and see if the support for XamlReader comes somewhere in 2017. In the meantime, I think that running Silverlight OOB will still be available, although not quite as user-friendly as running it in the browser. The other alternative is to give up on XAML and switch to SVG, I guess.


Return to “General Discussion and Other”

Who is online

Users browsing this forum: No registered users and 1 guest

 

 

cron