[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
  [Expand]Application Solution Components
  [Expand]Business Model Design
  [Collapse]Application Model
   [Expand]Model Editor
    Application Model Basics
    Business Model in the Application Model
    Application Model Structure
    Access the Application Model in Code
    Extend and Customize the Application Model in Code
    Built-in Nodes Generators
    Convert Application Model Differences
    Model Difference Storages
  [Expand]UI Construction
  [Expand]Controllers and Actions
  [Expand]Data Manipulation and Business Logic
  [Expand]Security System
  [Expand]System Module
  [Expand]Extra Modules
  [Expand]Debugging, Testing and Error Handling
  [Expand]Application Life Cycle
 [Expand]Design-Time Features
 [Expand]Task-Based Help
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Access the Application Model in Code

The Application Model represents a large data store. It is used to generate the UI and configure the application's behavior. This topic describes how to access and customize the Application Model in code.

You can use the following objects to access the Application Model in code:

Object Property
View View.Model
ActionBase ActionBase.Model
PropertyEditor PropertyEditor.Model
XafApplication XafApplication.Model

These properties return the IModelNode descendant object. This object provides access to the corresponding Application Model node and its properties. The object's Application property represents the root Application Model's Application node. Refer to the Application Model Structure topic for more information.

Expanded Application Model's and Controls's Changes

UI does not immediately reflect changes made in the Application Model. You should customize the Application Model before the control used to display the target UI element is created and loaded. If you customize the UI element after its control is created and initialized with default settings, access the control directly. Refer to the Access Editor Settings and Access Grid Control Properties topics for more information. You can also recreate a control with the latest Application Model changes as described in the How to: Apply Application Model Changes to the Current View Immediately topic.

Expanded Add and Remove Existing Nodes

Call the parent node's DevExpress.ExpressApp.Model.IModelNode.AddNode method to add a node and its IModelNode.Remove method to remove this node. The following code snippet demonstrates how to use these methods. The CreateMyViewNode Action exposed by MyViewController creates the MyClass_ListView_Custom View node. The DeleteMyViewNode Action searches the Application Model for the MyClass_ListView_Custom View node and removes it.


The code examples above make changes in the top layer of the Application Model (the end-user customizations layer). Use the approaches from the Extend and Customize the Application Model in Code topic to customize the underlying zero layer.

Expanded See Also

Is this topic helpful?​​​​​​​