Skip to main content

How to: Add controls to a panel

In the following example a new panel is created and floated. Then a property grid is added to the panel and this lists the dock panel’s properties. To add visual controls to the panel, the DockPanel.ControlContainer property is used. The result is shown below:

DockPanel_ControlContainer_ex

using DevExpress.XtraBars.Docking;
// ...
// Create a floating dock panel.
DockPanel panel1 = dockManager1.AddPanel(DockingStyle.Float);
panel1.Text = "Panel 1";
// Create a property grid and place it on the panel.
PropertyGrid pGrid = new PropertyGrid();
panel1.ControlContainer.Controls.Add(pGrid);
pGrid.Dock = DockStyle.Fill;
pGrid.SelectedObject = panel1;