Log In
[Expand]Welcome to DevExpress .NET Documentation
[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]Report Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
  [Expand]Application Solution Components
  [Expand]Business Model Design
  [Expand]Application Model
  [Collapse]UI Construction
    UI Element Overview
    Windows and Frames
    Action Containers
     Ways to Show a View
     List View Column Generation
     List View Columns Customization
     List View Bands Layout
     List View Edit Modes
    [Expand]List View Data Access Modes Overview
     Display Properties of a Referenced Object in the Master Object's View
   [Expand]View Items
    List Editors
    Add and Override Images
    Text Notifications
    Ways to Show a Confirmation Dialog
    ASP.NET Web Application Appearance
    Ways to Customize a Mobile Application
    Application Personalization
    Using a Custom Control that is not Integrated by Default
    XAF Mobile Wrappers for DevExtreme Widgets
  [Expand]Extend Functionality
  [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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

List View Column Generation

The eXpressApp Framework automatically generates all List Views according to the Application Model's information. This topic describes the specific rules used to generate a default set of List View columns.


The column generation logic is declared in the ModelListViewColumnsNodesGenerator class, which is the Node Generator (see Extend and Customize the Application Model in Code).

Expanded Simple Property Columns Generation

In this section, simple property columns are generated for the following persistent class:

The ListView's and LookupListView's Columns node contains child nodes generated for this class. In Mobile applications, the RowLayout node and its child nodes are generated in addition to Columns (Columns' nodes do not affect a List View layout- it is based on RowLayout nodes only). The following image illustrates these nodes in the Model Editor:

The column order specified using the IModelNode.Index properties corresponds to their declaration order. These columns are visible when their Index values are positive or zero.

The following attributes, applied in code, affect column visibility:

  • DefaultProperty and FriendlyKeyProperty Attributes

    If the class has a default or friendly key property (see DefaultPropertyAttribute and FriendlyKeyPropertyAttribute), its Lookup List View contains a single column corresponding to this property. In the general List View, the default property column has an index of zero and is displayed first. In Mobile applications, the ListView's and LookupListView's RowLayout node contains the single node corresponding to the default property. To display additional property values, add new Layout View Items to the RowLayout node. The code below demonstrates the DefaultProperty attribute in use, and the image illustrates the result.

    The FriendlyKeyProperty attribute has the same effect.

    If the business class exposes a property containing the "Name" substring in its name (excluding inherited properties), then it is considered as the default property:

    The DefaultProperty attribute overrides this behavior.

  • Browsable Attribute

    The corresponding column is not generated if the property is decorated with the Browsable attribute and false is passed as the parameter (see BrowsableAttribute).

  • VisibleInListView Attribute

    The corresponding column is generated but remains invisible if the property is decorated with the VisibleInListViewAttribute attribute and false is passed as the parameter. The Columns node's IModelNode.Index property is set to -1. You can use the Column Chooser or Model Editor to unhide such a column (see Change Field Layout and Visibility in a List View).

  • VisibleInLookupListView Attribute

    When a class has a default property, XAF generates one column for this property in the Lookup List View. To add a column in code, decorate the required property with the VisibleInLookupListViewAttribute and pass true as the attribute parameter. When the class has no default property, all property columns are generated in the Lookup List View. To hide a column corresponding to a certain property, decorate the property with the VisibleInLookupListViewAttribute, and pass false as the attribute parameter.

Expanded Reference Property Columns Generation

To demonstrate how the reference property columns are generated, the persistent class demonstrated in the previous section, will be extended with the PropertyA3 reference property of the ObjectB type

A column is generated to represent the PropertyA3 property by default. In Mobile applications, the ListView's and LookupListView's RowLayout node contains a single node corresponding to the first property:

In the UI, the PropertyA3 displays the PropertyB2's value, because the PropertyB2 is the ObjectB class' default property.


In Mobile applications, you need to add the new PropertyA3 Layout View Item to the RowLayout node to show the PropertyA3 property value in the List View.

If the PropertyA3 property is decorated by the ExpandObjectMembersAttribute with the ExpandObjectMembers.InListView parameter, then the columns for all ObjectB class' properties are generated in the ObjectA List View. The ExpandObjectMembersAttribute has no effect in Mobile List Views.

Expanded Columns, Generated in Inherited Class' List Views

Consider the following ObjectC class, derived from the ObjectA class:

Typically, the columns for this class properties are generated as usual (see the description of ObjectA List Views column generation above). The columns for derived properties are generated as hidden (with -1 indexes). Note the following specifics:

  • The intended behavior when the derived class has no default property, and its ancestor has a default property

    The ancestor class's default property is used as the default in a derived class' List View. In the general List View, this property's column gets the zero index and is shown first. In the Lookup List View, the default property ancestor class column is the only generated column. The following image illustrates the generated columns when the ProprertyA2 is the ObjectA class' default property:

  • The intended behavior, when the derived class has no public fields and properties

    In this case, columns generated for the derived class are the same as the ancestor class' columns, and they all are visible by default. The ancestor class's default property is used as the default in a derived class' List View.

Expanded Default Columns Width

Each column has an IModelColumn.Width property, specifying its width in a Windows Forms application. The following table demonstrates the default width values:

Type of Property Default Width Default Width in Lookups
The property is the class' default or friendly key property (see DefaultPropertyAttribute, FriendlyKeyPropertyAttribute). If a property contains "Name" in its name (excluding inherited properties), this property is also considered default. 400 340
A short value type property - int, float, double, decimal, char or bool. 50 50
Other properties (string, etc.) 70 50

Usually the default property contains the most details in the class, so a wide column is automatically generated for it. Short type values do not take much screen space, and their default columns are narrow.

In ASP.NET Web XAF applications, the web browser determines column widths based on the current theme and the displayed content's style - the Width property has no effect.

Expanded Columns Sorting Order

List Views are sorted by the default property values in ascending order (if the default property type is System.IComparable). The default column's IModelColumn.SortIndex is set to 0, and IModelColumn.SortOrder is set to ColumnSortOrder.Ascending. Other columns have the default SortIndex and SortOrder (-1 and ColumnSortOrder.None, respectively) values.

Expanded See Also

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