wpf-6820-controls-and-libraries-layout-management-dock-windows-getting-started-dock-layout-manager.md
This tutorial explains how to work with the Dock Layout Manager.
Run Demo: Visual Studio Docking
Drag the DevExpress DockLayoutManager from the Visual Studio Toolbox to the form.
<Window ...
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
Title="Docking UI" Height="350" Width="525" >
<Grid>
<dxdo:DockLayoutManager>
<dxdo:LayoutGroup Caption="LayoutRoot" Orientation="Vertical" >
<dxdo:LayoutPanel Caption="Panel1"/>
<dxdo:LayoutPanel Caption="Panel2"/>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
</Grid>
</Window>
Right-click the Dock Layout Manager , select Create Default Layout , and choose one of the predefined layouts.
Predefined layouts : Simple, IDE, MDI.
Simple
IDE
MDI
Select the panel, expand the command group (+), and click the Add a new panel button.
The following XAML code will be generated:
<dxdo:DockLayoutManager>
<!-- ... -->
<dxdo:LayoutPanel Caption="Panel"/>
<!-- ... -->
</dxdo:DockLayoutManager>
To add a control to the LayoutPanel, drag the control from the Toolbox to the panel.
The following example adds the TextBox control to Panel1 :
<dxdo:LayoutPanel Caption="Panel1">
<TextBox/>
</dxdo:LayoutPanel>
Right-click the panel and select Delete.
You can arrange panels into groups: Auto-Hide, Floating, Tabbed, and Document Group.
Click the pin button in a docked panel header. The Dock Layout Manager creates the auto-hidden group and adds the panel into it. Click the panel’s pin button again to dock it.
<dxdo:DockLayoutManager>
<dxdo:DockLayoutManager.AutoHideGroups>
<dxdo:AutoHideGroup DockType="Right">
<dxdo:LayoutPanel Caption="Panel2"/>
</dxdo:AutoHideGroup>
</dxdo:DockLayoutManager.AutoHideGroups>
<dxdo:LayoutGroup Caption="LayoutRoot">
<dxdo:LayoutPanel Caption="Panel1"/>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
Specify the panel’s AutoHideGroup.AutoHideType attached property to specify the location of the auto-hide panel (when it is hidden).
Specify the panel’s AutoHideSize dependency property to specify the panel size in auto-hide mode.
<dxdo:LayoutPanel Caption="Panel1" dxdo:AutoHideGroup.AutoHideType="Bottom"
dxdo:AutoHideGroup.AutoHideSize="200,250">
<!-- Content -->
</dxdo:LayoutPanel>
Drop a panel outside docking hints or double-click a panel header to make a floating group.
<dxdo:DockLayoutManager>
<dxdo:DockLayoutManager.FloatGroups>
<dxdo:FloatGroup FloatLocation="165,40" FloatSize="181,327">
<dxdo:LayoutPanel Caption="Panel2"/>
</dxdo:FloatGroup>
</dxdo:DockLayoutManager.FloatGroups>
<dxdo:LayoutGroup Caption="LayoutRoot">
<dxdo:LayoutPanel Caption="Panel"/>
<dxdo:LayoutPanel Caption="Panel1"/>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
Set the DockLayoutManager.FloatingMode property to Desktop to allow your users to drag floating panels outside the window.
<dxdo:DockLayoutManager FloatingMode="Desktop">
Drag a panel to the middle of another panel to create a tabbed group. Click tab headers to switch between panels. Drag the panel’s header outside the tabbed group to restore the panel.
<dxdo:DockLayoutManager>
<dxdo:LayoutGroup Caption="LayoutRoot">
<dxdo:TabbedGroup>
<dxdo:LayoutPanel Caption="Panel1"/>
<dxdo:LayoutPanel Caption="Panel"/>
</dxdo:TabbedGroup>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
Click the Add a new document group button to add a new document group. Tabbed style is the default style.
<dxdo:DockLayoutManager>
<dxdo:LayoutGroup Caption="LayoutRoot">
<dxdo:LayoutPanel Caption="Panel1"/>
<dxdo:LayoutPanel Caption="Panel"/>
<dxdo:DocumentGroup>
<dxdo:DocumentPanel Caption="Document">
<Grid/>
</dxdo:DocumentPanel>
<dxdo:DocumentPanel Caption="Document">
<Grid/>
</dxdo:DocumentPanel>
</dxdo:DocumentGroup>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
Set the Document Group’s MDIStyle property to MDI to enable MDI mode.
<dxdo:DockLayoutManager FloatingMode="Desktop">
<dxdo:LayoutGroup Caption="LayoutRoot">
<dxdo:LayoutPanel Caption="Panel1" ItemWidth="0.52*" />
<dxdo:DocumentGroup ItemWidth="1.48*" MDIStyle="MDI">
<dxdo:DocumentPanel Caption="Document" MDILocation="0,0" MDISize="262,125">
<Grid/>
</dxdo:DocumentPanel>
<dxdo:DocumentPanel Caption="Document" MDILocation="108,133" MDISize="259,118">
<Grid/>
</dxdo:DocumentPanel>
</dxdo:DocumentGroup>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
Refer to the following section for more information on MDI mode: DocumentGroup and DocumentPanel
Use the ClosedPanelsBarVisibility property to specify the Closed Panels bar visibility.
<dxdo:DockLayoutManager ClosedPanelsBarVisibility="Auto">
<!-- ... -->
</dxdo:DockLayoutManager>
See Also