Skip to main content
A newer version of this page is available. .

DockingOptions.AllowDockToCenter Property

Gets or sets whether or not panels can dock to the middle of the DockManager’s parent container (Form or UserControl). This option has no effect in MDI mode when DocumentManager is not used.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v22.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(DefaultBoolean.Default)]
[XtraSerializableProperty]
public DefaultBoolean AllowDockToCenter { get; set; }

Property Value

Type Default Description
DefaultBoolean Default

The DefaultBoolean enumerator value that specifies whether or not this DockManager allows docking its panels to the container center. The DefaultBoolean.Default value is equivalent to DefaultBoolean.True.

Available values:

Name Description
True

true. DefaultBoolean.True has a constant value of 0, while the standard true value corresponds to a value of 1. In Visual Basic, do not use implicit conversion of Boolean values to DefaultBoolean, and vice versa, as the conversion may produce incorrect results.

False

false. DefaultBoolean.False has a constant value of 1, while the standard false value corresponds to a value of 0. In Visual Basic, do not use implicit conversion of Boolean values to DefaultBoolean, and vice versa, as the conversion may produce incorrect results.

Default

The default behavior determined by the control’s logic.

Property Paths

You can access this nested property as listed below:

Object Type Path to AllowDockToCenter
DockManager
.DockingOptions .AllowDockToCenter

Remarks

If the AllowDockToCenter option is enabled, both you at design time and your users at runtime can drag a panel into the central docking hint of a parent container.

addDT

After the first panel is docked to the container middle, you can dock more panels to the center as tabs, or to this central panel’s sides.

addMore

To dock panels to the central area in code, use the DockPanel.DockTo(DockPanel, DockingStyle) method.

dockManager1.Clear();

DockPanel p1 = new DockPanel() { Text = "Panel 1" };
DockPanel p2 = new DockPanel() { Text = "Panel 2" };
DockPanel p3 = new DockPanel() { Text = "Panel 3" };
DockPanel p4 = new DockPanel() { Text = "Panel 4" };
DockPanel p5 = new DockPanel() { Text = "Panel 5"};
DockPanel p6 = new DockPanel() { Text = "Panel 6"};
DockPanel p7 = new DockPanel() { Text = "Panel 7" };

dockManager1.AddPanel(DockingStyle.Left, p1);
dockManager1.AddPanel(DockingStyle.Top, p2);
dockManager1.AddPanel(DockingStyle.Right, p3);
dockManager1.AddPanel(DockingStyle.Bottom, p4);
dockManager1.AddPanel(DockingStyle.Fill, p5);
dockManager1.AddPanel(DockingStyle.Float, p6);
dockManager1.AddPanel(DockingStyle.Float, p7);

p6.DockTo(p5, DockingStyle.Left);
p7.DockTo(p5, DockingStyle.Fill);

code

To prevent a specific panel from docking to the container center, handle the DockManager.ShowingDockGuides event and disable the central dock guide.

private void DockManager1_ShowingDockGuides(object sender, ShowingDockGuidesEventArgs e)
{
    if (e.Panel == p7 && e.TargetPanel == null)
        e.Configuration.Disable(DevExpress.XtraBars.Docking2010.Customization.DockGuide.Center);
}
See Also