DockPanel.ParentPanel Property
Gets the immediate parent panel of the current panel.
Namespace: DevExpress.XtraBars.Docking
Assembly: DevExpress.XtraBars.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Property Value
Type | Description |
---|---|
DockPanel | A DockPanel object representing the immediate parent panel of the current panel. null if the panel does not belong to any dock panel. |
Remarks
Panels can be added to other panels by forming split or tab containers. The ParentPanel property allows you to access the immediate parent panel of the current panel. If the panel does not belong to any panel, this property returns null.
If a panel belongs to a specific panel which in turn belongs to another panel, etc, then the DockPanel.RootPanel property can be used to get the panel’s primary parent panel (the root panel which is not owned by any other panel).
Example
In the following example three panels are created and docked to form a split container. Then the DockPanel.Tabbed property of the split container is set to true and this transforms the split container into a tab container. The result is shown below:
using DevExpress.XtraBars.Docking;
// ...
// Create a panel and dock it to the left edge of the form.
DockPanel p1 = dockManager1.AddPanel(DockingStyle.Left);
p1.Text = "Panel 1";
// Add a button to the panel.
DevExpress.XtraEditors.SimpleButton btn = new DevExpress.XtraEditors.SimpleButton();
btn.Text = "Print...";
p1.ControlContainer.Controls.Add(btn);
// Add a new panel to the first panel. This forms a split container.
DockPanel p2 = p1.AddPanel();
p2.Text = "Panel 2";
// Add a new panel to the split container.
DockPanel p3 = p1.ParentPanel.AddPanel();
p3.Text = "Panel 3";
// ...
// Transform the split container into a tab container.
p1.ParentPanel.Tabbed = true;