Search This Blog

Tuesday, March 7, 2017

How to change an Application Model option globally or for multiple nodes

I have recently updated one of the articles on the subject in our support knowledge base and wanted to test-drive this content with you: https://www.devexpress.com/kb=T271022


Since the Application Model basically represents a skeleton of the application UI, based on which visual controls for supported platforms are created at runtime, updates to various options in the source UI metadata (both at design time and runtime) can be a good and often platform-agnostic alternative to customizing underlying controls directly in Controllers or other UI entities (examples: one, two, three). The most difficult thing is to perform this update at the right moment or using the right event in the View life cycle!
Even though this may sound like a quite an advanced topic, this is one of the core concepts for our framework, which I recommend you get familiar with.







Your feedback is welcome, as always!

We also hope to use this KB as a base for future updates of the online documentation at  Concepts > Application Model  for easier discoverability, so your early feedback on the main methods I described is welcome. In particular, I would greatly appreciate your comments on whether you experienced the scenarios needed runtime Application Model updates and exactly which techniques you used (e.g., #2.1, 2.2 or all ).


2 comments:

  1. Sometimes customizations are too cumbersome. If one wants to change the "2-columns-DetailView-layout" to have (for example) 1 or 3 columns: it would be the most easy way to inherit from the appropriate class and override some method. But the CreateDeclaredPropertiesLayoutGroup method of the DevExpress.ExpressApp.Model.NodeGenerators.ModelDetailViewLayoutNodesGenerator class is "private" and "static" and so cannot be overridden. So one has to copy all the DX-Code which is not the best way.

    ReplyDelete
  2. @Olaf: My team and I greatly appreciate your feedback in this regard. I am afraid node generators are not supposed to be inherited by design, so your idea will not work even if we make this method virtual. Anyway, I can foresee solutions at different levels for your ultimate goal. For instance, it is possible to create a custom LayoutManager for WinForms/ASP.NET or change the Layout node structure at the Application Model level, which looks the best here. It also does not look like a big deal to make our default generator mode flexible, e.g. by introducing an option for "columns count". We will be more than happy to learn more about your business requirements and suggest a precise solution if you contact us using the Support Center and provide additional information on your goal and problems, such as screenshots of the current and desired layout, code and description of your current solution (just to be sure we got you right) as well as information on how often you need to perform this particular layout customization (e.g., maybe it is easier to design it at design time for a few Views using the Model Editor).

    ReplyDelete