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]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
  [Collapse]Business Model Design
    Business Model Design Basics
    Built-in Business Classes for Most Popular Scenarios
   [Expand]Business Model Design with Entity Framework
   [Expand]Business Model Design with XPO
    Non-Persistent Objects
    PropertyChanged Event in Business Classes
   [Collapse]Data Types Supported by built-in Editors
     Key Properties
    [Expand]String Properties
    [Expand]Numeric Properties
    [Expand]Date and Time Properties
    [Expand]Boolean Properties
    [Expand]BLOB Image Properties
    [Expand]Collection Properties
    [Collapse]Reference (Foreign Key, Complex Type) Properties
      Reference Properties in XPO
      Reference Properties in Entity Framework
      Reference Properties in Domain Components
    [Expand]File Attachment Properties
    [Expand]Type Properties
    [Expand]Enumeration Properties
    [Expand]Criteria Properties
    [Expand]Color Properties
     Geolocation Properties
     Miscellaneous Property Types
    Mapping Complex Types to the Database
   [Expand]Types Info Subsystem
    Connect an XAF Application to a Database Provider
    Data Annotations in Data Model
    Create and Update the Application's Database
  [Expand]Application Model
  [Expand]UI Construction
  [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
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
[Expand]End-User Documentation

Reference (Foreign Key, Complex Type) Properties

Reference properties are properties whose type is added to the Application Model (when the property type is a persistent or non-persistent business class). Reference properties (together with the Collection Properties) allow you to setup relationships between your business objects. In XAF, reference properties can be displayed in the following:

  • a lookup control;
  • a set of editors that present individual properties of the referenced object;
  • a Detail Property Editor that presents a Detail View for the referenced object;
  • a button edit that expands a referenced object Detail View in a separate modal window (typically used for aggregated objects).

WinForms

ASP.NET

Note

To see Reference Property Editors in action, refer to the Property Editors | Reference Properties section in the Feature Center demo installed with XAF. By default, the Feature Center demo is installed in %PUBLIC%\Documents\DevExpress Demos 17.1\Components\eXpressApp Framework\FeatureCenter. The ASP.NET version of this demo is available online at http://demos.devexpress.com/XAF/FeatureCenter/.

Expanded Examples

Expanded UI-Independent Property Editors for Reference Properties

Property Editor Type and Description WinForms Control ASP.NET Control

DetailPropertyEditor - Used to display reference properties.

The DetailPropertyEditor creates a Template that represents a Frame. The Frame contains a Detail View. This Detail View displays the object specified by the reference property. For details on Templates, Frames and Views, refer to the UI Element Overview topic. By default, the Detail View is determined automatically, according to the object type. To use a custom Detail View, specify the IModelMemberViewItem.View property value in the Model Editor.
NestedFrameTemplate NestedFrameControl

Expanded WinForms Property Editors for Reference Properties

Each WinForms Property Editor has a control that displays a corresponding property in a Detail View, and a repository item that displays a property in a List Editor that supports in-place editing. The table below shows both the control and repository item.

Property Editor Type and Description Control Repository Item

ObjectPropertyEditor - Used for AggregatedAttribute reference properties.

To set an object to a property displayed by this Property Editor, click the editor's button, double-click the editor or press SPACEBAR. A window with a Detail View will be invoked. When OK is clicked, changes made to the object will be saved and the object will be assigned to the property (if it has not yet been assigned). For details on how to customize the invoked window, refer to the Add Actions to a Popup Window and Dialog Controller topics.
Note that you can invoke the ObjectPropertyEditor's Detail View window by pressing the SPACEBAR or ENTER while the ObjectPropertyEditor is focused.

ObjectEdit - a descendant of the ButtonEdit editor used by the IntegerPropertyEditor. RepositoryItemObjectEdit - a descendant of the RepositoryItemButtonEdit repository item from the XtraEditors Library.

LookupPropertyEditor - Used for non-aggregated reference properties.

The LookupControlTemplate Template is used in the drop-down popup window. This Template displays a Frame with a List View. The List View represents the objects of the property's type. You can filter the List View. (See Filter Lookup Editor Data Source for details.)
The drop-down window can contain the Search functionality. See How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows for details.
To expand the drop-down window, use Alt+Down Arrow.
To invoke a detail View for the selected object in a List View, press CTRL+SHIFT and click the object.
To empty the Property Editor, click the Clear button . To hide the Clear button, set the IModelCommonMemberViewItem.AllowClear property to False in the Model Editor.

LookupEdit - a descendant of the PopupContainerEdit editor from the XtraEditors Library. RepositoryItemLookupEdit - a descendant of the RepositoryItemPopupContainerEditrepository item from the XtraEditors Library.

Expanded ASP.NET Property Editors for Reference Properties

Each ASP.NET Property Editor has controls that display a property in a Detail View's View mode and in an Edit mode (see DetailView.ViewEditMode). These controls are listed in the table below.

Property Editor Type and Description

Control Used in View Mode

Control Used in Edit Mode

ASPxObjectPropertyEditor - Used for AggregatedAttribute reference properties.

This Property Editor is inherited from the ASPxObjectPropertyEditorBase class, which creates a LinkButton, a NavigateToObject SimpleAction, and raises the Action's Execute event when the link button is clicked. In the Execute event handler, a separate window is invoked. This window displays a read-only Detail View representing the object referenced by the property.
The ASPxObjectPropertyEditor creates a ButtonEdit, an ObjectWindow PopupWindowShowAction, and raises the Action's Execute event when the button is clicked. In the Execute event handler, a separate window is invoked. This window displays a Detail View representing the object referenced by the property. When clicking OK in this window, changes made to the object will be saved and the object will be assigned to the property (if it has not yet been assigned). For details on how to customize the invoked window, refer to the Add Actions to a Popup Window and Dialog Controller topics.

The ASPxObjectPropertyEditor is not designed to update other editors when its popup control is closed in in-line edit mode, so the ImmediatePostDataAttribute has no effect on it.

System.Web.UI.WebControls.LinkButton XafASPxButtonEdit - a descendant of the ASPxButtonEdit editor from the ASPxEditors library

ASPxLookupPropertyEditor - Used for non-aggregated reference properties.

This Property Editor is inherited from the ASPxObjectPropertyEditorBase class, which creates a LinkButton and a NavigateToObject SimpleAction, and raises the Action's Execute event when the link button is clicked. In the Execute event handler, a window is created. This window displays a read-only Detail View representing the object referenced by the property.
The ASPxLookupPropertyEditor creates either an ASPxLookupFindEdit or ASPxLookupDropDownEdit.
The ASPxLookupFindEdit is created when the Search functionality is required. This occurs in two cases. First, when the number of objects to be displayed exceeds the value of the IModelOptions.LookupSmallCollectionItemCount property of the Application Model's Options node. Second, when the LookupEditorMode property of the BOModel | Class | Member node or the corresponding Views | <DetailView> | Items | <PropertyEditor> node is set to AllItemsWithSearch or Search. For details on the search functionality, refer to the How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows topic.
ASPxLookupDropDownEdit is created when the search functionality is not required.
To empty the Property Editor, click the Clear button . To hide the Clear button, set the IModelCommonMemberViewItem.AllowClear property to False in the Model Editor.

System.Web.UI.WebControls.LinkButton ASPxLookupDropDownEdit
or
ASPxLookupFindEdit control from the DevExpress.ExpressApp.Web assembly.

You can access the ASPxLookupDropDownEdit and ASPxLookupFindEdit controls through the DropDownEdit and FindEdit properties of the ASPxLookupPropertyEditor class. These properties provide access to the inner ASPxComboBox and ASPxButtonEdit controls, which can be accessed through the DropDown and Editor properties respectively.

Note

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