Docks the current panel to the specified panel.
A DockPanel object representing the target dock panel.
If the target panel does not contain children, a split container is created in place of the target panel. The split container will display both the target and current panel.
This DockTo overload appends the current panel to the target container, i.e., the current panel is added at the last position among the container’s children. To add a panel to a specific position, use the DockPanel.DockTo overload which takes an index parameter.
The following code creates two panels. One panel is docked to the left edge of the form, the second one is floating. The floating panel is then docked to the first panel and this creates a split container.
Then a new floating panel is created. It’s then added as a new item to the created split container at the first position. In this example panels are docked to other panels via the DockPanel.DockTo method. However it’s also possible to create and dock a panel to another panel via the DockPanel.AddPanel method.
The result is shown below:
using DevExpress.XtraBars.Docking; // ... // Create two panels. DockPanel dp1 = dockManager1.AddPanel(DockingStyle.Left); dp1.Text = "Panel 1"; DockPanel dp2 = dockManager1.AddPanel(DockingStyle.Float); dp2.Text = "Panel 2"; // Dock the dp2 panel to the dp1 panel. This will create a split container. dp2.DockTo(dp1); // Create a floating panel. DockPanel dp3 = dockManager1.AddPanel(DockingStyle.Float); dp3.Text = "Panel 3"; // Dock this panel to the split container at the first position. dp3.DockTo(dp1.ParentPanel, 0);