windowsforms-devexpress-dot-xtralayout-4b778a8d.md
A regular group with or without a header and borders.
Namespace : DevExpress.XtraLayout
Assembly : DevExpress.XtraLayout.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public class LayoutControlGroup :
LayoutGroup,
ISupportDXSkinColorsEx,
ISupportDXSkinColors,
ISupportAdornerElementEx,
ISupportAdornerElement,
IUpdateAdornerUI
Public Class LayoutControlGroup
Inherits LayoutGroup
Implements ISupportDXSkinColorsEx,
ISupportDXSkinColors,
ISupportAdornerElementEx,
ISupportAdornerElement,
IUpdateAdornerUI
The following members return LayoutControlGroup objects:
Show 18 links
A regular group can display layout items (LayoutControlItem), other regular groups, and tabbed groups (TabbedControlGroup). Set the GroupBordersVisible property to false to hide the group’s border.
The Layout Control displays its layout items within groups. The Layout control automatically creates the top level group (LayoutControlGroup) that is the parent group for all layout items and groups. Use the LayoutControl.Root property to access the top level group.
A Layout Group can be displayed as a tab page within a tabbed group (TabbedControlGroup). Use the TabbedGroup.AddTabPage method to add a group (tab page) to the tab group.
The following image shows a form with the Layout control. The root group displays the ‘Job Title’ and ‘Contact Name’ items, regular and tabbed groups. The tabbed group contains two tabs which display the Photo and Notes groups:
The following example creates a tabbed group with one tab page.
using DevExpress.XtraLayout;
using DevExpress.XtraEditors;
private void Form1_Load(object sender, EventArgs e) {
layoutControl1.BeginUpdate();
try {
// Createa a tabbed group.
TabbedControlGroup tabbedGroup = new TabbedControlGroup();
tabbedGroup.Name = "tabbedGroupA";
// Greates a tab page.
LayoutControlGroup tabPage = tabbedGroup.AddTabPage();
tabPage.Text = "Tab A";
tabPage.Name = "tabA";
// Creates a layout item within the tab page.
LayoutControlItem item1 = tabPage.AddItem();
// Embeds the Text Editor into the layout item.
TextEdit textEdit1 = new TextEdit();
textEdit1.Name = "TextEdit1";
item1.Control = textEdit1;
item1.Text = "Name";
// Adds the tabbed group to the root group.
layoutControl1.Root.Add(tabbedGroup);
} finally {
layoutControl1.EndUpdate();
}
}
Imports DevExpress.XtraLayout
Imports DevExpress.XtraEditors
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
layoutControl1.BeginUpdate()
Try
' Createa a tabbed group.
Dim tabbedGroup As New TabbedControlGroup()
tabbedGroup.Name = "tabbedGroupA"
' Greates a tab page.
Dim tabPage As LayoutControlGroup = tabbedGroup.AddTabPage()
tabPage.Text = "Tab A"
tabPage.Name = "tabA"
' Creates a layout item within the tab page.
Dim item1 As LayoutControlItem = tabPage.AddItem()
' Embeds the Text Editor into the layout item.
Dim textEdit1 As New TextEdit()
textEdit1.Name = "TextEdit1"
item1.Control = textEdit1
item1.Text = "Name"
' Adds the tabbed group to the root group.
layoutControl1.Root.Add(tabbedGroup)
Finally
layoutControl1.EndUpdate()
End Try
End Sub
Do one of the following to create a group within another group:
Size constraints of a layout group depend on size constraints set to its items or embedded controls.
using System.Drawing;
using DevExpress.XtraLayout;
layoutControlItemA1.SizeConstraintsType = SizeConstraintsType.Custom;
layoutControlItemA1.MaxSize = new Size(250, 24);
layoutControlItemA1.MinSize = new Size(100, 24);
Imports System.Drawing
Imports DevExpress.XtraLayout
layoutControlItemA1.SizeConstraintsType = SizeConstraintsType.Custom
layoutControlItemA1.MaxSize = New Size(250, 24)
layoutControlItemA1.MinSize = New Size(100, 24)
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();
}
Imports DevExpress.XtraLayout
Imports DevExpress.XtraLayout.Utils
Dim lc As New LayoutControl()
lc.Dock = System.Windows.Forms.DockStyle.Fill
Me.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.
Dim group1 As New LayoutControlGroup()
group1.Name = "GroupDetails"
group1.Text = "Details"
' Create a layout item within the group.
Dim item1 As LayoutControlItem = group1.AddItem()
' Bind a control to the layout item.
Dim textEdit1 As New TextEdit()
textEdit1.Name = "TextEdit1"
item1.Control = textEdit1
item1.Text = "Name"
' Create a layout item that will display a date editor.
Dim dtEdit1 As New DateEdit()
dtEdit1.Name = "dtEdit1"
Dim item2 As 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()
End Try
Object MarshalByRefObject Component DevExpress.XtraLayout.SupportVisitor BaseLayoutItem LayoutItemContainer LayoutGroup LayoutControlGroup LayoutViewCard
See Also