Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Collapse]Concepts
  [Expand]Application Solution Components
   Client-Side Mobile Application
  [Expand]Business Model Design
  [Expand]Application Model
  [Collapse]UI Construction
    UI Element Overview
    Windows and Frames
   [Expand]Templates
    Action Containers
   [Expand]Views
   [Collapse]View Items
     Implement Custom View Items
     Implement Custom Property Editors
     View Items Layout Generation
     View Items Layout Customization
    List Editors
    Add and Override Images
    Text Notifications
    Ways to Show a Confirmation Dialog
    ASP.NET Web Application Appearance
    Application Personalization
    Using a Custom Control that is not Integrated by Default
  [Expand]Extend Functionality
  [Expand]Data Manipulation and Business Logic
  [Expand]Security System
  [Expand]Localization
  [Expand]System Module
  [Expand]Extra Modules
  [Expand]Debugging and Error Handling
  [Expand]Filtering
  [Expand]Application Life Cycle
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Expand]Task-Based Help
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Implement Custom View Items

The eXpressApp Framework supplies a set of built-in View Item types listed in the View Item topic. In most cases, they will be enough to build a business application. But in some specific cases, you may need a custom View Item, or need to customize one of the supplied items. This topic details how to implement a custom View Item class by inheriting the base ViewItem or one of its descendants.

Note

To learn how to implement a custom Property Editor - the View Item that is used to display business class properties, refer to the Implement Custom Property Editors topic.

Expanded Implement a Fully Custom View Item (Inherit the Base ViewItem Class)

If there are no built-in View Items that suit your requirements, inherit from the ViewItem class. To make a new child node appear in the ViewItems node of the Application Model, the ViewItemAttribute should be applied to the ViewItem descendant. Pass a Model interface derived from the IModelViewItem interface or one of its descendants as the attribute's parameter. Then, the custom View Item will be available in the Application Model, and you will be able to use it in Views. A custom interface is required to define the properties that will be available for the implemented View Item in the Application Model. When the View Item is instantiated, the Application Model's node corresponding to the Item, is passed via the model parameter to the View Item's constructor:

This allows you to use the data from the corresponding Application Model's node, to initialize and configure the View Item.

The following code snippet demonstrates a part of an example given in the How to: Implement a View Item topic. A custom ClassIconDetailItem View Item is implemented by inheriting from the ViewItem class. The implemented View Item uses a custom IModelClassIcon interface, which does not declare any additional properties.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E242.

As the result of this code, the ClassIcon child node appears in the Application Model. The following image shows a fragment from the Model Editor:

Expanded See Also

How would you rate this topic?​​​​​​​