Skip to main content

How to: Combine panels into a tab container

In the following code two floating panels are created and then combined to form a single tab container. A tab container is created via the DockPanel.DockAsTab method and this method can be used to create new tabs in the created tab container later on.

Which tab in the tab container contains which panel is specified by this method’s index parameter. In this example, the tab page containing the second panel (dp2) will be added to the first tab because the index parameter is set to 0.

The result is shown below:

DockPanel.DockAsTab_index_ex

using DevExpress.XtraBars.Docking;
// ..
// Create two floating panels.
DockPanel dp1 = dockManager1.AddPanel(DockingStyle.Float);
dp1.Text = "Panel 1";
DockPanel dp2 = dockManager1.AddPanel(DockingStyle.Float);
dp2.Text = "Panel 2";
// Create a tab container consisting of these panels. 
// Panel dp2 will be displayed within the first tab.
dp2.DockAsTab(dp1, 0);