How to: Specify a Display Member (for a Lookup Editor, Detail Form Caption, etc.) How to: Specify display members (for finding editors, etc. For more information form title)

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:

XAF each business object used in the application should have a default property. In XAF application UI, the default attribute value is treated as a human-readable identifier (for example, the full name of a contact, task themes). The default attribute values ​​are shown in the following contents:

  • Detail View captions;
  • the leftmost columns of List Views;
  • Lookup List Views;
  • Lookup Editors in an unexpanded state.
  • Detail view title;
  • Left-most column of the list view;
  • Find a list view;
  • Find an undeployed state editor.

Default Property of a Business Class

The default attribute 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.

It is strongly recommended that you apply XafDefaultProperty Properties and default attribute name passed to this property. The default attribute must be declared as public and visible (not to use a browser (false) attribute hidden). If you do not declare a default property, the UI may be displayed or GUID integer identifier. These identifiers are not suitable for the end user sees, may cause 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.

Alternatively, you can use the System. DefaultProperty component model named attribute space.

 

Tip 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.
It can automatically detect XAF default properties. If the attribute name is Name, or it contains substring Name, this attribute is considered the default value, and without explicitly specifying default properties.

 Property Displayed in a Lookup Editor

Find properties that are displayed in the 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.

The default attribute of the business object reference is displayed in the lookup attribute editor. If you need to use other attributes in the lookup, use the model editor IModelCommonMemberViewItem. Finding property.

LookupProperty

Guess you like

Origin www.cnblogs.com/foreachlife/p/How-to-Specify-a-Display-Member-for-a-Lookup-Editor-Detail-Form-Caption-etc.html