Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

public void DockTo(
    DockingStyle dock
)

#Parameters

Name Type Description
dock DockingStyle

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

#Remarks

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.

Note

#Example

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:

DockPanel.DockTo_style_ex

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.
dp1.DockTo(DockingStyle.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.
dp2.DockTo(DockingStyle.Bottom);
See Also