Skip to main content

NavBarGroup.ControlContainer Property

Gets or sets the control container displayed by the group when its NavBarGroup.GroupStyle property is set to NavBarGroupStyle.ControlContainer.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v23.2.dll

NuGet Packages: DevExpress.Win, DevExpress.Win.Navigation

Declaration

[Browsable(false)]
[DefaultValue(null)]
public virtual NavBarGroupControlContainer ControlContainer { get; set; }

Property Value

Type Default Description
NavBarGroupControlContainer null

A NavBarGroupControlContainer object representing the container displayed by the group when the NavBarGroupStyle.ControlContainer style is applied. null if this style is not applied.

Remarks

Setting the NavBarGroup.GroupStyle property to NavBarGroupStyle.ControlContainer allows you to display arbitrary controls within a NavBar group. If this setting is applied, the group creates and displays a container control - a surface on which you can place any controls. These will be displayed by the group when it is expanded. The ControlContainer property allows you to access the group’s control container.

Switching the NavBarGroup.GroupStyle property from NavBarGroupStyle.ControlContainer to another value destroys the control container and all the controls it owns. In this case, the ControlContainer property returns null.

To specify the height of the group’s control container, use the NavBarGroup.GroupClientHeight property.

Before accessing and customizing the ControlContainer, ensure that the group has been added to the NavBarControl.Groups collection.

Example

The following sample code embeds a DateControl into a NavBarControl’s group. To allow control embedding, the NavBarGroup.GroupStyle property is set to ControlContainer. Then, the DateControl is added to the group via the NavBarGroup.ControlContainer property.

The image below shows the result.

embedding_datecontrol_into_a_group

DevExpress.XtraEditors.DateControl dc = new DevExpress.XtraEditors.DateControl();

navBarGroup1.GroupStyle = DevExpress.XtraNavBar.NavBarGroupStyle.ControlContainer;
navBarGroup1.ControlContainer.Controls.Add(dc);                     
navBarGroup1.GroupClientHeight = dc.Height + 3;
navBarControl1.Width = dc.Width + 3;
See Also