Back to Devexpress

LayoutGroup Class

wpf-devexpress-dot-xpf-dot-docking-2925c5a6.md

latest15.3 KB
Original Source

LayoutGroup Class

A container for items and groups.

Namespace : DevExpress.Xpf.Docking

Assembly : DevExpress.Xpf.Docking.v25.2.dll

NuGet Package : DevExpress.Wpf.Docking

Declaration

csharp
public class LayoutGroup :
    BaseLayoutItem,
    IGeneratorHost,
    ILogicalOwner,
    IInputElement,
    ISupportOriginalSerializableName,
    IItemContainer
vb
Public Class LayoutGroup
    Inherits BaseLayoutItem
    Implements IGeneratorHost,
               ILogicalOwner,
               IInputElement,
               ISupportOriginalSerializableName,
               IItemContainer

The following members return LayoutGroup objects:

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.

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:

xaml
<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):

csharp
LayoutGroup layoutgroup = new LayoutGroup();
LayoutPanel layoutpanel = new LayoutPanel() { Caption = "Tools" };
layoutgroup.Add(layoutpanel);
DockLayoutManager1.DockController.Dock(layoutgroup);
vb
Dim layoutgroup As LayoutGroup = New LayoutGroup()
Dim layoutpanel As LayoutPanel = New LayoutPanel() With {
    .Caption = "Tools"
}
layoutgroup.Add(layoutpanel)
DockLayoutManager1.DockController.Dock(layoutgroup)

Tip

Topic : How to Create a Simple Layout with Dock Panes

Child Items

LayoutGroups can contain the following child objects:

Customize LayoutGroups

PropertyDescription
OrientationSpecifies the LayoutGroup ‘s child items orientation.
The BaseLayoutItem’s VerticalAlignment and HorizontalAlignmentSpecify the LayoutGroup ‘s alignments.
AllowSplittersSpecifies whether a user can resize the LayoutGroup ‘s child items.
BaseLayoutItem.ItemHeight and BaseLayoutItem.ItemWidthSpecify 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 :

MethodDescription
AddPanelCreates 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.
DockDocks 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.
HideEnables 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:

EventDescription
DockItemActivatedFires after a dock item has been activated.
DockItemActivatingFires before a dock item is activated, and allows you to prevent this action.
DockItemClosedFires after a dock item has been closed (hidden).
DockItemClosingFires before a dock item is closed (hidden), and allows you to prevent this action.
DockItemCollapsedFires after a visible auto-hidden dock panel has slid away.
DockItemDockingFires before a dock item is dragged over dock hints, and allows you to prevent dock zones from being displayed.
DockItemDraggingFires repeatedly while a dock panel is being dragged.
DockItemEndDockingFires after a dock item has been dropped, and allows you to prevent this action.
DockItemExpandedFires after a hidden auto-hidden dock panel has slid out.
DockItemHiddenFires after a dock item has been made auto-hidden.
DockItemHidingFires before a dock item is auto-hidden, and allows you to prevent this action.
DockItemRestoredFires after a dock item has been restored from the closed (hidden) state.
DockItemRestoringFires before a dock item is restored from the closed (hidden) state, and allows you to prevent this action.
DockItemStartDockingFires 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.

wpf-dock-layout-manager-limit-layout-group-customization-at-runtime/CS/DXDockingForLayoutPurposes/MainWindow.xaml#L18

xml
<dxd:DockLayoutManager x:Name="rootDockLayoutManager" AllowCustomization="True">
    <dxd:LayoutGroup>
        <dxd:DocumentPanel>

wpf-dock-layout-manager-define-prism-regions-for-dock-layout-manager-elements/CS/PrismOnDXDocking/Shell.xaml#L17

xml
<Style TargetType="dxdo:DocumentPanel" BasedOn="{StaticResource {x:Type dxdo:LayoutPanel}}"/>
<Style TargetType="dxdo:LayoutGroup">
    <Setter Property="DestroyOnClosingChildren" Value="False"/>

wpf-docklayoutmanager-use-services-that-implement-the-idocumentmanagerservice/CS/DXDocumentUIServiceSample/MainWindow.xaml#L15

xml
<dxdo:DockLayoutManager>
    <dxdo:LayoutGroup>
        <dxdo:TabbedGroup>

wpf-dock-layout-manager-insert-prism-regions-into-dock-layout-manager-panels/CS/PrismSupportSample/Shell.xaml#L10

xml
<dxdo:DockLayoutManager x:Name="dockManager" DataContext="{Binding ElementName=list, Path=SelectedItem}">
    <dxdo:LayoutGroup>
        <dxdo:LayoutGroup Orientation="Vertical">

wpf-docklayoutmanager-use-imvvmdockingproperties-to-build-dock-ui-with-mvvm/CS/MainWindow.xaml#L12

xml
<dxdo:DockLayoutManager.LayoutRoot>
    <dxdo:LayoutGroup Caption="LayoutRoot" >
        <dxdo:DocumentGroup x:Name="DocumentsGroup"/>

Inheritance

Show 15 items

Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control DevExpress.Xpf.Docking.psvFrameworkElement BaseLayoutItem LayoutGroup AutoHideGroup

FloatGroup

TabbedGroup

DocumentGroup

DashboardLayoutGroup

See Also

LayoutGroup Members

LayoutRoot

AutoHideGroup

FloatGroup

Layout UI Items

DevExpress.Xpf.Docking Namespace