LayoutControlGroup Class
A regular group with or without a header and borders.
Namespace: DevExpress.XtraLayout
Assembly: DevExpress.XtraLayout.v18.1.dll
Declaration
Related API Members
The following members accept/return LayoutControlGroup objects:
Remarks
This class represents a regular group that can display layout items (LayoutControlItem objects), other regular groups and tabbed groups (TabbedControlGroup objects). A group is bound by a frame by default, which can be hidden by setting the LayoutGroup.GroupBordersVisible property to false.
In the Layout Control, layout items can only be displayed within groups. The top level group, which is the parent for all the items displayed within the control, is represented by the LayoutControlGroup object. It can be accessed via the LayoutControl.Root property. A root group is automatically created when a LayoutControl is created.
A LayoutControlGroup object can be displayed as a tab within a tabbed group represented by the TabbedControlGroup class. To add a group as a tab, use the TabbedGroup.AddTabPage method.
The following image shows a form which contains a layout control. The root group displays two regular layout items (Job Title and Contact Name), regular group (Personal Info) and a tabbed group. The tabbed group contains two tabs which display two groups (Photo and Notes):
A nesting group within a specific group can be created as follows:
- via the LayoutControlGroup.AddGroup method. In this case, the created group is automatically added to the current group..
- via the group’s constructor. The new group can then be added to another group via the LayoutGroup.Add or LayoutGroup.Move method.
Example
The following example shows how to create a group within the LayoutControl’s root group and add two layout items to it. A group is created using its constructor and added to the root group with the LayoutGroup.Add method.
The first layout item is created using the group’s LayoutControlGroup.AddItem method.
The second item is created using the LayoutControlItem‘s constructor. It’s then positioned to the right of the first item using the BaseLayoutItem.Move method.
using DevExpress.XtraLayout;
using DevExpress.XtraLayout.Utils;
LayoutControl lc = new LayoutControl();
lc.Dock = System.Windows.Forms.DockStyle.Fill;
this.Controls.Add(lc);
// Lock the layout control to prevent excessive updates.
lc.BeginUpdate();
try {
// Hide the root group's border and caption.
lc.Root.GroupBordersVisible = false;
// Create a new Details group.
LayoutControlGroup group1 = new LayoutControlGroup();
group1.Name = "GroupDetails";
group1.Text = "Details";
// Create a layout item within the group.
LayoutControlItem item1 = group1.AddItem();
// Bind a control to the layout item.
TextEdit textEdit1 = new TextEdit();
textEdit1.Name = "TextEdit1";
item1.Control = textEdit1;
item1.Text = "Name";
// Create a layout item that will display a date editor.
DateEdit dtEdit1 = new DateEdit();
dtEdit1.Name = "dtEdit1";
LayoutControlItem item2 = new LayoutControlItem(lc, dtEdit1);
item2.Text = "Date";
// Position this item to the right of item1
item2.Move(item1, InsertType.Right);
// Add the created group to the root group.
lc.Root.Add(group1);
}
finally {
// Unlock and update the layout control.
lc.EndUpdate();
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the LayoutControlGroup class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.