[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 Collection Properties

If a bound object contains IList properties, the DataLayoutControl does not generate layout items for these properties by default. This behavior can be changed by setting the DataLayoutControl.AllowGeneratingCollectionProperties option to True. When you do so, the DataLayoutControl will generate layout items with embedded GridControls (by default) to present the contents of IList properties.


For a bound object's properties of the Array and IEnumerable types, layout items are added to the layout regardless of the DataLayoutControl.AllowGeneratingCollectionProperties option. These layout items contain embedded GridControls by default. This topic shows how to replace default controls used to present these and IList properties.

Consider the following BookLibrary business object that contains the Books property of the List<Book> type.

You can bind a BookLibrary instance to a DataLayoutControl using the BindingSource component as follows.

If you run the application, the DataLayoutControl will generate a layout that only provides two fields - "Name" and "Description".

To generate a layout item that presents the contents of the Books property, set the DataLayoutControl.AllowGeneratingCollectionProperties option to True.

The layout item that corresponds to the Books property will contain a GridControl by default. At runtime, the grid will display the contents of the bound property.

The AllowGeneratingCollectionProperties option can also be enabled at design time using the DataLayoutControl's wizard, invoked by clicking the Retrieve Fields command from the control's smart tag pane. This wizard's second page allows you to specify the controls for generated layout items. For instance, you can replace the GridControl used by default for collection properties with the TreeList, VerticalGrid, etc.

To replace default controls for generated items with custom ones in code, handle the DataLayoutControl.FieldRetrieving event.

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