Is it possible to implement xaml storage in the database and build the interface while the application is running in the Windows Universal app? For example, for different users, depending on the rights, display different controls with their binding to different data. Where to dig or what to read? It is assumed that users will create content and an interface for it, with providing access to other users. therefore, you will need to store in the database.

  • one
    awful idea. will be very slow. - Yura Ivanov
  • How are you going to build the XAML that you are going to put in the database? - Athari
  • I'm just new to this issue, just starting to master the development under WP. While I pretend how to implement. Rested against the inability to handle XAML on the fly. Those. The user in the application has selected interface elements and handlers from the list, such as the designer. And other users download this interface at will and use . They probably swung too much)) - LmonteK
  • in such cases - different control rivet, add selectors and so on - Andrii Krupka

2 answers 2

Here's how to create an element with XAML code on the fly.

UIElement createElement(string xaml) { // не забываем указывать xmlns в XAML-коде: // xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" var stringReader = new StringReader(xaml); XmlReader xmlReader = XmlReader.Create(stringReader); return XamlReader.Load(xmlReader) as UIElement; } 

I highly recommend this approach. This can only be used in extreme cases.

It is unlikely that users of your application will create any XAML code in the application manually.

    It is easier to make several different UserControl in advance and, as you wish, depending on the different rights, display this or that user control on the Page in ContentControl . Only God forbid you from loading the interface elements from the database!