Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Collapse]Form Layout Managers
    Side Panel
   [Collapse]Layout Manager
    [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 Item
    [Expand]Layout Groups
    [Expand]Tabbed Group
    [Expand]Other Layout Elements
    [Expand]Customization Capabilities
    [Expand]Size and Alignment
     Flow Layout
     Table Layout
     Focus Management
    [Expand]Appearance and Look and Feel
    [Expand]Miscellaneous
    [Expand]Examples
    [Expand]Member Tables
   [Expand]Tabbed MDI Manager
    Tab Control
   [Expand]Wizard Control
    Workspace Manager
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

Note

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.

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