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]ASP.NET Core 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
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 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 referenced object properties;
  • a Detail Property Editor that presents the referenced object's Detail View (for WinForms and ASP.NET applications only);
  • a button editor that expands a referenced object Detail View in a separate modal window (typically used for aggregated objects).

WinForms

ASP.NET

Mobile

Note

Refer to the Property Editors | Reference Properties section in the Feature Center demo installed with XAF to see Reference Property Editors in action. The Feature Center demo is installed in %PUBLIC%\Documents\DevExpress Demos 17.2\Components\eXpressApp Framework\FeatureCenter by default. 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 Mobile 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. Refer to the UI Element Overview topic. The Detail View is determined automatically, according to the object type, by default. Specify the IModelMemberViewItem.View property value in the Model Editor to use a custom Detail View.

NestedFrameTemplate NestedFrameControlNew MobileWindowTemplate

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. Both the control and repository item are shown below.

  • ObjectPropertyEditor

    Control: ObjectEdit - a ButtonEdit editor descendant used by the IntegerPropertyEditor.

    Repository Item: RepositoryItemObjectEdit - a descendant of the XtraEditors Library's RepositoryItemButtonEdit item.

    Description:

    Used for AggregatedAttribute reference properties.

    Click the editor's button, double-click the editor or press SPACEBAR to set an object to a property in this Editor. This invokes a window with a Detail View. Click OK to save changes made to the object and assign it to the property (if it has not yet been assigned). Refer to the Add Actions to a Popup Window and Dialog Controller topics for details on how to customize the invoked window.

    Note that you can invoke the ObjectPropertyEditor's Detail View window by pressing the SPACEBAR or ENTER while the ObjectPropertyEditor is focused.

  • LookupPropertyEditor

    Control: LookupEdit - a descendant of the XtraEditors Library's PopupContainerEdit editor.

    Repository Item: RepositoryItemLookupEdit - a descendant of the XtraEditors Library's RepositoryItemPopupContainerEdit item.

    Description:

    Used for non-aggregated reference properties.

    The LookupControlTemplate Template is used in the drop-down pop-up window. This Template displays a Frame with a List View representing 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.

    Use Alt+Down Arrow to expand the drop-down window. Press CTRL+SHIFT and click the object to invoke a Detail View for the selected object in a List View. Click the Clear button to empty the Property Editor. Set the IModelCommonMemberViewItem.AllowClear property to False in the Model Editor to hide the Clear button.

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 and Edit mode (see DetailView.ViewEditMode). These controls are listed below.

  • ASPxObjectPropertyEditor

    View mode control: System.Web.UI.WebControls.LinkButton.

    Edit model control: XafASPxButtonEdit - a descendant of the ASPxEditors Library's ASPxButtonEdit editor.

    Description:

    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. A separate window is invoked in the Execute event handler which displays a Detail View representing the object referenced by the property. Clicking OK saves changes made to the object and assigns it to the property (if it has not yet been assigned). Refer to the Add Actions to a Popup Window and Dialog Controller topics for details on how to customize the invoked window.

    The ASPxObjectPropertyEditor is not designed to update other editors when its pop-up control is closed in in-line edit mode, so the ImmediatePostDataAttribute does not affect it.

  • ASPxLookupPropertyEditor

    View mode control: System.Web.UI.WebControls.LinkButton.

    Edit mode control: ASPxLookupDropDownEdit.

    Description:

    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. A window is created in the Execute event handler which 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. Refer to the How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows topic for details on the search functionality.

    ASPxLookupDropDownEdit is created when the search functionality is not required.

    Click the Clear button to empty the Property Editor. Set the IModelCommonMemberViewItem.AllowClear property to False in the Model Editor to hide the Clear button.

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

Expanded Mobile Property Editors for Reference Properties

Each Mobile Property Editor has widgets that display a property in a Detail View's View and Edit mode (see DetailView.ViewEditMode). These widgets are listed below.

  • MobileObjectPropertyEditor

    View mode control: Label that displays text using the div HTML element.

    Edit mode control: Button that uses the dxButton widget.

    Description:

    Used for AggregatedAttribute reference properties.

  • MobileLookupPropertyEditor

    View mode control: Label that displays text using the div HTML element.

    Edit mode control: Lookup that uses the dxLookup widget.

    Description:

    Used for non-aggregated reference properties.

Note

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