Layout Group's Settings
- 4 minutes to read
Like regular layout items, layout groups are components, so their settings can be displayed at design time within the Properties window. To select a group and list its settings in the Properties window, click its caption or border. If a layout item is currently selected, you can press the ESC key to select the group that owns this item.
Caption
Each group displays a caption by default (except for the root group whose caption is initially hidden). The appearance and style of the group caption is dependent on the current paint scheme. A few examples are given below.
Painting style: Office 2010 Blue skin | Painting style: Office 2016 Colorful skin | Painting style: Office 2016 Dark skin |
---|---|---|
To specify a group caption, use the group’s BaseLayoutItem.Text inherited property. When a group is rendered as a tab page, this property specifies the text displayed within the tab.
The group caption can be aligned along the top, bottom, left or right edge. Use the LayoutControlGroup.TextLocation (BaseLayoutItem.TextLocation) property to specify the caption position.
The group caption visibility is affected by two properties: BaseLayoutItem.TextVisible and LayoutGroup.GroupBordersVisible. The caption is visible if both of these properties are set to true.
Caption Image
You can display a custom image within the group header, before or after the text.
To specify an image for the group, use one of the following methods.
- Assign an image directly to the group’s LayoutGroup.CaptionImage property.
- Assign an image list to the control’s LayoutControl.Images property and then assign the index of the required image in this list to the LayoutGroup.CaptionImageIndex property.
Use the LayoutGroup.CaptionImageLocation property to specify the image’s position.
Group Styles
You can specify the group border and caption style by modifying the LayoutGroup.GroupStyle property.
If this property has its default Inherited value, the group style depends on the currently applied skin.
Caption Expand Button
Layout groups can be collapsed and expanded. Although it’s possible to collapse and expand layout groups freely in code using the LayoutGroup.Expanded property, end-users are not able to collapse/expand groups at runtime by default. To make this feature available to end-users, enable a group expand button with the LayoutGroup.ExpandButtonVisible property.
The expand button can be displayed at the beginning or at the end of the group header. Use the LayoutGroup.HeaderButtonsLocation property to specify the expand button’s position.
Custom Header Buttons
You can add custom regular and check buttons to the group header using the LayoutGroup.CustomHeaderButtons collection. The position of these buttons is controlled by the LayoutGroup.HeaderButtonsLocation property.
To respond to clicking/checking custom buttons, handle the LayoutGroup.CustomButtonClick, LayoutGroup.CustomButtonChecked and LayoutGroup.CustomButtonUnchecked events.
Borders and spacing
If a group is not displayed as a tab page, its borders are visible by default. You can, however, hide the borders by setting the LayoutGroup.GroupBordersVisible property to false. Note that hiding borders hides the group’s caption as well.
For each layout group, you can specify the inner and outer indents for the borders. It’s possible to specify different indents for the top, left, bottom and right edges or specify matching indents. The indents are determined by the BaseLayoutItem.Padding and BaseLayoutItem.Spacing properties. Please refer to the Spacing and Paddings topic for additional information.
Appearance
The following table covers properties to customize the appearance of layout groups.
Property | Description |
---|---|
LayoutItemContainer.AppearanceGroup | Specifies the appearance settings for the current group and its children (background colors of the group and its children, the group caption’s text color and font settings, etc). |
BaseLayoutItem.AppearanceItemCaption | Specifies the appearance settings used to paint captions of layout items within the current and nested groups. |
LayoutItemContainer.AppearanceTabPage | Specifies the appearance settings used to paint tabbed groups that belong to the current and nested groups. |
The Layout Control supports the appearance setting inheritance mechanism. For instance, the background color assigned to a group’s AppearanceGroup.BackColor property is automatically applied to the group’s children (including its nested groups). However, you are still able to change a nested group’s AppearanceGroup.BackColor property and so override the parent group’s setting.
Generally, instead of customizing the appearance of individual groups, you can customize the appearance settings of the root group. The root group’s appearance will be propagated through its nested groups. To access the root group’s settings, use the LayoutControl.Root property.
Customization settings
The ability to customize a group’s layout at runtime is determined by the LayoutItemContainer.AllowCustomizeChildren property. If this property is set to false, it’s not possible to add items to, remove them from, or move them within the group.
To prevent a group from being hidden in the Customization Form, use the group’s BaseLayoutItem.AllowHide property.