[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Collapse]Form Layout Managers
    Side Panel
   [Collapse]Layout and Data Layout Controls
    [Expand]Product Information
    [Expand]Getting Started
    [Expand]Layout Control
    [Collapse]Data Layout Control
      Binding to Data Source in Code
      Displaying Nested Objects as Groups
      Data Annotation Attributes - Building Layout from Business Object
      Displaying Collection Properties
    [Expand]Layout Items
    [Expand]Layout Groups
    [Expand]Tabbed Groups
    [Expand]Other Layout Elements
    [Expand]Design-Time and Runtime Customization
    [Expand]Size and Alignment
     Flow Layout
     Table Layout
     Focus Management
    [Expand]Appearance and Look and Feel
    [Expand]Member Tables
   [Expand]Tabbed MDI Manager
    Tab Control
   [Expand]Wizard Control
    Workspace Manager
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[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]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Displaying Nested Objects as Groups

For each property of a bound business object, the Data Layout Control generates a layout item with a control. If the bound business object contains a nested object of another class, this nested object can be rendered as a nested layout group, provided that the DataLayoutControl.AllowGeneratingNestedGroups setting is set to True (initially this functionality is disabled). For each field of the nested object, a layout item with a control will be generated and placed inside the created group.

Consider an example in which a Person object contains an AddressInfo object of the Address type.

To bind a Person object to the Data Layout Control, the following code can be used:

As a result, the Data Layout Control generates a layout as demonstrated in the image below.

Note the generated "AddressInfo" group used to edit properties of the nested AddressInfo object.

You can change the name of the generated group using the System.ComponentModel.DataAnnotations.DisplayAttribute with the GroupName parameter. The code below demonstrates how to do this.


To use Data Annotation attributes, ensure that the System.ComponentModel.DataAnnotations assembly is added to your project.

The GroupName parameter also allows you to arrange the nested layout items horizontally (instead of the default vertical alignment) and to render the nested object as a tab. For more information on Data Annotation attributes, see this link.

Is this topic helpful?​​​​​​​