DockingOptions.AllowDockToCenter Property
Gets or sets whether or not panels can dock to the middle of the DockManager’s parent container (Form or UserControl).
Namespace: DevExpress.XtraBars.Docking
Assembly: DevExpress.XtraBars.v19.2.dll
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 | Corresponds to a Boolean value of true. |
False | Corresponds to a Boolean value of false. |
Default | The value is determined by the current object’s parent object setting (e.g., a control setting). |
Property Paths
You can access this nested property as listed below:
Library | Object Type | Path to AllowDockToCenter |
---|---|---|
WinForms Controls | SnapDockManager |
|
DockManager |
|
|
Reporting | XRDesignDockManager |
|
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.
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.
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);
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);
}