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 @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Loading XAML documents

Postby JS-Support @Userware » 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.

asthomas
Posts: 1
Joined: Wed Dec 20, 2017 6:21 am

Re: Loading XAML documents

Postby asthomas » Wed Dec 20, 2017 6:58 am

I see this post is 2 years old. Do you have an updated timeline on when XamlReader will be available?

XamlReader is a show-stopper for us. We are currently working with Fayde and would be keen to switch to C#/XAML, but without XamlReader we cannot consider it.

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

Re: Loading XAML documents

Postby JS-Support @Userware » Wed Dec 20, 2017 7:27 am

Hi,

Thanks for your message.

We have made progress in this direction by implementing Linq to XML (XDocument, XElement, etc.) in the latest Beta 13, so reading a XAML file at runtime should now be easier. However, this feature is not yet on our short term roadmap because there are features that are requested by more people (see UserVoice), but we will post again as soon as we have a ETA for this feature.

Thanks again.
Regards,
JS-Support


Return to “General Discussion and Other”

Who is online

Users browsing this forum: No registered users and 29 guests

 

 

cron