LayoutGroup Class

A container for items and groups.

Namespace: DevExpress.Xpf.Docking

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

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. This document describes only how to use LayoutGroups in the dock UI.

Tip

Refer to the following topic for more information on how to use LayoutGroups in layout UI: Layout 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.

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.
See Also