windowsforms-4921-controls-and-libraries-form-layout-managers-layout-and-data-layout-controls-data-layout-control.md
The DataLayoutControl extends the layout management functionality provided by the Layout Control with tools that help you to:
The following tutorial shows how to get started with the DataLayoutControl.
First off, drop a DataLayoutControl onto the form and bind the control to a target data source. This can be accomplished in a number of ways:
Using the Data Source Configuration Wizard, which makes it easy to bind to various data sources. To invoke the wizard, click the control’s smart tag and select Data Source Wizard in the Tasks pane that will appear.
Using the popup window invoked on clicking the dropdown button next to the Choose Data Source command.
With the DataLayoutControl.DataSource and DataLayoutControl.DataMember properties in the Properties window.
Once the DataLayoutControl has been bound to a data source, the control remains empty, since no field has been retrieved from the data source as yet.
Click the control’s smart tag and select Retrieve Fields.
The following wizard will be opened. Its first page allows you to confirm the target data source (or provide another one) and specify binding settings.
Click Next to switch to the next page, which allows you to:
Click Finish to generate the layout.
If you need to replace a generated editor with another one, you can do this using one of two approaches.
Click the generated editor, invoke its smart tag and select a new editor in the Change Editor Type dropdown.
Click the DataLayoutControl’s smart tag and select Edit Fields.
After the initial layout has been created, you can customize it as needed.
Note
LayoutControl items tend to occupy all available space, and have Size Constraints that limit maximum and minimum item sizes. Use the Control.MinimumSize and Control.MaximumSize properties to set these constraints.
Control.MinimumSize property to limit the minimum control size and display scrollbars when this size becomes larger than the available visible area.Control.MaximumSize property to limit the maximum control size. You can also add Empty Space Items that occupy remaining free space when the avialable area becomes larger than this maximum size. This allows you to limit the size of one item, while other items can be freely resized.Control.MaximumSize property to limit the maximum control size. You can also add Empty Space Items that occupy remaining free space when the avialable area becomes larger than this maximum size. This allows you to limit the size of one item, while other items can be freely resized.For more information on design-time and runtime customizations, see the Customization Capabilities and Customizing a Layout In Code topics.
See Also
Binding to Data Source in Code
Displaying Nested Objects as Groups
Displaying Collection Properties
Data Annotation Attributes - Building Layout from Business Object