Creating Layout Items
- 2 minutes to read
This document describes how layout items can be created at design and runtime.
Creating Items at Design Time
When you drop a control onto the Layout Control, a layout item is automatically created (animation). Since the layout item has been created, use its settings to specify where the control is displayed, how big it is and how it responds to its container being resized.
Some layout items display automatically aligned text labels near their controls. You can change the location of a text label relative to a control, change its text and visibility, etc. For detailed information on how to deal with these labels, see Item Label.
Creating Items at Runtime
To create and add layout items in code use one of the following options:
- create a new instance of the LayoutControlItem class. Add it to the group via the LayoutGroup.Add method or by assigning the item's BaseLayoutItem.Parent property to the group which the item should be displayed in.
- via the group's LayoutControlGroup.AddItem method. This method creates a new item and adds it to the group.
To allow a Layout Control's layout to be customized and serialized you need to ensure that Name properties of the layout items and controls within the layout items are set to unique values. You must set the Name properties to unique values for layout items and controls that are created at runtime. The control's Name property must be initialized before this control is assigned to the LayoutControlItem.Control property.
- How to: Create a layout in Regular mode in code
- How to: Create layout groups and items in code
- How to: Create a tabbed group in code