Skip to main content

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.v24.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 dock panels can be docked to the container center. The DefaultBoolean.Default value is equivalent to DefaultBoolean.True.

Available values:

Name Description Return Value
True

The value is true.

0

False

The value is false.

1

Default

The value is specified by a global option or a higher-level object.

2

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