Skip to main content

LayoutGroup Class

A container for items and groups.

Namespace: DevExpress.Xpf.Docking

Assembly: DevExpress.Xpf.Docking.v24.1.dll

NuGet Package: DevExpress.Wpf.Docking

Declaration

public class LayoutGroup :
    BaseLayoutItem,
    IGeneratorHost,
    ILogicalOwner,
    IInputElement,
    ISupportOriginalSerializableName,
    IItemContainer

Remarks

The DockLayoutManager control allows you to use LayoutGroups both in dock and layout UIs.

When a LayoutGroup includes a LayoutPanel, the group creates the dock UI. If it includes a LayoutControlItem, the group creates a layout UI.

This document describes how to use LayoutGroups in the dock UI only.

WPF Dock Layout Manager - Layout Groups

Tip

Refer to the following topic for more information on how to use LayoutGroups in layout UI: Layout UI Items.

Run Demo: Visual Studio Docking

Create LayoutGroups

The DockLayoutManager should always have a root group. Refer to the following topic for more information: Layout Groups.

In XAML

The following code sample creates a root LayoutGroup (LayoutRoot) that contains two LayoutPanels:

<Window ...
  xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking">
  <Grid>
    <dxdo:DockLayoutManager>
      <dxdo:LayoutGroup x:Name="LayoutRoot" Orientation="Vertical" >
        <dxdo:LayoutPanel Caption="Panel1"/>
        <dxdo:LayoutPanel Caption="Panel2"/>
      </dxdo:LayoutGroup>
    </dxdo:DockLayoutManager>
  </Grid>
</Window>

In Code

The following code sample adds a LayoutGroup with a nested LayoutPanel (Tools):

LayoutGroup layoutgroup = new LayoutGroup();
LayoutPanel layoutpanel = new LayoutPanel() { Caption = "Tools" };
layoutgroup.Add(layoutpanel);
DockLayoutManager1.DockController.Dock(layoutgroup);

Dock Layout Manager - Create LayoutGroup In-Code

Child Items

LayoutGroups can contain the following child objects:

Customize LayoutGroups

Property Description
Orientation Specifies the LayoutGroup‘s child items orientation.
The BaseLayoutItem’s VerticalAlignment and HorizontalAlignment Specify the LayoutGroup‘s alignments.
AllowSplitters Specifies whether a user can resize the LayoutGroup‘s child items.
BaseLayoutItem.ItemHeight and BaseLayoutItem.ItemWidth Specify the LayoutGroup‘s height and width.
LayoutItemInterval

Gets or sets the distance between immediate child dock items. This is a dependency property.

LayoutGroupInterval

Gets or sets the distance between immediate child LayoutGroup objects. This is a dependency property.

DockItemInterval

Gets or sets the distance between immediate child LayoutControlItem objects. This is a dependency property.

Runtime Operations

Use the following DockLayoutManager.DockController object’s methods to control a LayoutGroup:

Method Description
AddPanel Creates a LayoutPanel and docks it at the specified side of the DockLayoutManager container (root group).
Close(BaseLayoutItem) Closes the specified item.
CloseAllButThis(BaseLayoutItem) Closes all items except the specified one within this item’s container.
Dock Docks the specified item. This method is in effect for newly created, floating, auto-hidden, or closed (hidden) items.
Float(BaseLayoutItem) Makes the specified item floating.
Hide Enables the auto-hide mode for the item/panel and hides it at a corresponding edge of the DockLayoutManager container.
Insert(LayoutGroup, BaseLayoutItem, Int32) Inserts the specified item into the specified group at a specific position.
Rename(BaseLayoutItem) Starts dock item renaming.
Restore(BaseLayoutItem) Restores a closed (hidden) panel at its previous dock position.

Events

Use the following DockLayoutManager events to control a dock element at runtime:

Event Description
DockItemActivated Fires after a dock item has been activated.
DockItemActivating Fires before a dock item is activated, and allows you to prevent this action.
DockItemClosed Fires after a dock item has been closed (hidden).
DockItemClosing Fires before a dock item is closed (hidden), and allows you to prevent this action.
DockItemCollapsed Fires after a visible auto-hidden dock panel has slid away.
DockItemDocking Fires before a dock item is dragged over dock hints, and allows you to prevent dock zones from being displayed.
DockItemDragging Fires repeatedly while a dock panel is being dragged.
DockItemEndDocking Fires after a dock item has been dropped, and allows you to prevent this action.
DockItemExpanded Fires after a hidden auto-hidden dock panel has slid out.
DockItemHidden Fires after a dock item has been made auto-hidden.
DockItemHiding Fires before a dock item is auto-hidden, and allows you to prevent this action.
DockItemRestored Fires after a dock item has been restored from the closed (hidden) state.
DockItemRestoring Fires before a dock item is restored from the closed (hidden) state, and allows you to prevent this action.
DockItemStartDocking Fires when a docking operation starts, and allows you to prevent this operation.

The following code snippets (auto-collected from DevExpress Examples) contain references to the LayoutGroup 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.

See Also