DockPanel.DockTo(DockingStyle) Method

Docks the current panel to the form (or user control) using the specified style.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v21.1.dll


public void DockTo(
    DockingStyle dock


Name Type Description
dock DockingStyle

A DockingStyle value specifying how the panel is docked to the form (user control).


The DockTo method docks the current panel to the DockManager’s container (form/user control referred to by the DockManager.Form property).

The dock parameter specifies how the panel is docked. It can be set to the following values.

Panels are arranged within the form according to these panels’ indexes. A panel’s index matches the position of the panel in the DockManager.RootPanels collection. Panels with low indexes are placed nearer the form’s edges. Panels with higher indexes are placed nearer the form’s center.

The DockTo method appends the current panel to this collection and thus the panel will be displayed closest to the form’s center. To dock a panel at a specific position within the form, use the DockPanel.DockTo overload which takes the index parameter. For more information on the layout of panels within the form, refer to the DockPanel.Index property.



In the following code two floating panels are created and then docked to the form referred to by the dock manager’s DockManager.Form property. To dock a panel to a form the DockPanel.DockTo method is used.

The order in which the panels are docked determines the layout of dock panels within the form. The first panel will occupy the form’s left edge entirely, while the second panel will be docked only within the region not occupied by the first panel.

The result is shown below:


using DevExpress.XtraBars.Docking;

// Create two floating panels.
DockPanel dp1 = DockManager1.AddPanel(DockingStyle.Float);
dp1.Text = "dockPanel3";
DockPanel dp2 = DockManager1.AddPanel(DockingStyle.Float);
dp2.Text = "dockPanel1";
// Dock the first panel to left.
// Dock the second panel to bottom. 
// This panel will be docked within the form's area that isn't occupied by the first panel.
See Also