DockPanel.DockTo(DockPanel, Int32) Method
Docks the current panel to the specified panel in the specified position.
public void DockTo( DockPanel panel, int index )
Public Sub DockTo( panel As DockPanel, index As Integer )
A DockPanel object representing the target dock panel.
A zero-based integer specifying the position at which to dock the current 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.
The index parameter specifies the position in which the current panel is docked. Set the index parameter to 0 to add the panel as the first one amongst the target container’s children. Set index to 1 to add the panel as the second one, etc. Setting the index parameter to -1appends the panel to the container. To get the position of a panel amongst its sibling panels, use the DockPanel.Index property.
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);