Back to Devexpress

DockPanel.DockAsTab(DockPanel) Method

windowsforms-devexpress-dot-xtrabars-dot-docking-dot-dockpanel-dot-dockastab-x28-devexpress-dot-xtrabars-dot-docking-dot-dockpanel-x29.md

latest4.0 KB
Original Source

DockPanel.DockAsTab(DockPanel) Method

Appends a tab containing the current panel to the target tab container. The target tab container is created if necessary.

Namespace : DevExpress.XtraBars.Docking

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public void DockAsTab(
    DockPanel panel
)
vb
Public Sub DockAsTab(
    panel As DockPanel
)

Parameters

NameTypeDescription
panelDockPanel

A DockPanel object representing the target tab container or target tab container’s tab, or a panel that points to the location at which to create the target tab container.

|

Remarks

If the target panel does not represent a tab container or a tab container’s tab, this method creates a new target tab container and positions it where the target panel is. Otherwise, the current panel is added as a tab page to the existing tab container.

The new tab containing the current panel is added as the last tab in the target tab container. To add a tab containing the current panel in a specific position, use the DockPanel.DockAsTab overload which takes the index parameter. Please refer to this topic, for more information on the DockAsTab method’s behavior.

Example

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:

csharp
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);
vb
Imports DevExpress.XtraBars.Docking
' ...
' Create two floating panels.
Dim dp1 As DockPanel = DockManager1.AddPanel(DockingStyle.Float)
dp1.Text = "Panel 1"
Dim dp2 As DockPanel = 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)

See Also

AddPanel()

DockTo

Index

AddPanel

DockPanel Class

DockPanel Members

DevExpress.XtraBars.Docking Namespace