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]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]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

Note

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.

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