Back to Devexpress

DockPanel.DockTo(DockingStyle) Method

windowsforms-devexpress-dot-xtrabars-dot-docking-dot-dockpanel-dot-dockto-x28-devexpress-dot-xtrabars-dot-docking-dot-dockingstyle-x29.md

latest5.5 KB
Original Source

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

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public void DockTo(
    DockingStyle dock
)
vb
Public Sub DockTo(
    dock As DockingStyle
)

Parameters

NameTypeDescription
dockDockingStyle

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:

csharp
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);
vb
Imports DevExpress.XtraBars.Docking
' ...
' Create two floating panels.
Dim dp1 As DockPanel = DockManager1.AddPanel(DockingStyle.Float)
dp1.Text = "dockPanel3"
Dim dp2 As DockPanel = 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

AddPanel()

DockAsTab

Index

AddPanel

DockPanel Class

DockPanel Members

DevExpress.XtraBars.Docking Namespace