Log In
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET 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
    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]System Module
  [Expand]Extra Modules
  [Expand]Debugging and Error Handling
  [Expand]Application Life Cycle
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Task-Based Help
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[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. There are certain rules used to generate a default set of List View columns that minimize required customizations. These rules are described in this topic. Use this information to understand XAF better and improve your business classes for better default column set generation.


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

Expanded Simple Properties Column Generation

Consider the following persistent class:

The following image illustrates ListView nodes with Columns child nodes generated for this class.

The column order specified via the IModelNode.Index properties corresponds to the order of their declaration. As the Index values are non-negative, these columns are visible.

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

  • DefaultProperty and FriendlyKeyProperty Attributes

    If the class has the default property, or friendly key property (see DefaultPropertyAttribute and FriendlyKeyPropertyAttribute), its Lookup List View contains the single column corresponding to this property. In the general List View, the default property column has an index of zero and is displayed first. Below is the code demonstrating the DefaultProperty attribute in use and an image illustrating 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 this property is considered default:

    The DefaultProperty attribute overrides this behavior.

  • Browsable Attribute

    If the property is decorated with the Browsable attribute, with false passed as the parameter (see BrowsableAttribute), then the corresponding column is not generated in all List Views.

  • VisibleInListView Attribute

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

  • VisibleInLookupListView Attribute

    When a class has a default property, a single column is generated for this property in the Lookup List View. To add one more 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 Properties Columns Generation

Assume that the ObjectA class illustrated in a previous section of this document exposes the PropertyA3 reference property of the ObjectB type.

By default, an ordinary column will be generated to represent the PropertyA3 property:

In the UI, the PropertyB2 values will be displayed in the PropertyA3 column, as the PropertyB2 is the ObjectB class' default property.

If the PropertyA3 property is decorated by the ExpandObjectMembersAttribute with the ExpandObjectMembers.InListView parameter, then the columns for all ObjectB class' properties will be generated in the ObjectA List View.

Expanded Columns, Generated in Inherited Class' List Views

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

Typically, the columns for the properties of this class will be 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). There are several specifics you should know about:

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

    The default property of the ancestor class acts as the default in a derived class' List View. In the general List View, the default property of the ancestor class column gets the zero index. So, it becomes visible and goes first. In the Lookup List View, the default property ancestor class column is the only column generated. The following image illustrates the generated columns when the ProprertyA2 is the ObjectA class' default property.

  • The designed behavior, when the derived class has none of its own 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 default property of the ancestor class acts as the default in a derived class' List View.

Expanded Default Columns Width

Each column has a IModelColumn.Width property, specifying its width in a Windows Forms application. Width values, used by default, are the following:

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
The property is of the short value type - int, float, double, decimal, char or bool. 50 50
Other properties (string, etc) 70 50

Typically, the default property is the most descriptive property in the class, so the wide column is generated for it by default. Short type values usually do not take much screen space, so their default columns are narrow.

In ASP.NET Web XAF applications, column widths are determined by the web browser based on the styles defined by the current theme and the displayed content. So, the Width property has no effect.

Expanded Columns Sorting Order

By default, 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 values of SortIndex and SortOrder (-1 and ColumnSortOrder.None, respectively).

Expanded See Also

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