The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

How to: Specify a Display Member (for a Lookup Editor, Detail Form Caption, etc.)

  • 2 min to read

Each business object used in an XAF application should have a default property. The default property value is treated as a human-readable identifier in an XAF application UI (e.g., FullName of a Contact, Subject of a Task, etc.). Default property values are displayed in the following:

  • Detail View captions;
  • the leftmost columns of List Views;
  • Lookup List Views;
  • Lookup Editors in an unexpanded state.

Default Property of a Business Class

It is strongly recommended that you apply the XafDefaultPropertyAttribute attribute and pass the default property name to this attribute. The default property must be declared as public and visible (not hidden using the Browsable(false) attribute). If you do not declare a default property, a GUID or Integer identifier may be displayed in the UI. These identifiers are not intended to be seen by end users and may lead to confusion.

using DevExpress.ExpressApp.DC;
// ...
[XafDefaultProperty(nameof(Subject))]
public class Task {
    // ...
    public string Subject { get; set; }
    // ...
}

Alternatively, you can use the DefaultProperty attribute from the System.ComponentModel namespace.

Tip

XAF can detect the default property automatically. If a property name is Name, or it includes the Name substring, then this property is considered default, and there is no need to specify the default property explicitly.

Property Displayed in a Lookup Editor

The default property of a referenced business object is displayed in a Lookup Property Editor. If you need to use another property in lookups, use the IModelCommonMemberViewItem.LookupProperty property in the Model Editor.

LookupProperty