Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

NavBarControl.ActiveGroup Property

Returns an object representing the currently active group.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v24.2.dll

NuGet Package: DevExpress.Win

#Declaration

[DefaultValue(null)]
public NavBarGroup ActiveGroup { get; set; }

#Property Value

Type Default Description
NavBarGroup null

A NavBarGroup object representing the currently active group.

#Remarks

Read the ActiveGroup property to obtain a NavBarGroup object representing the currently active group. Assign the NavBarGroup object to this property to make the group active. It implies expanding the group and collapsing all others. Thus the ActiveGroup property is only in effect if a single group can be expanded at a time (this depends on the paint style applied).

Note that if a NavBarGroup object that does not belong to the NavBarControl control, is assigned to the ActiveGroup property, all groups are collapsed. Use the NavBarControl.Groups property to access the collection of groups owned by the NavBarControl control. This property returns a NavGroupCollection type object. Use its NavGroupCollection.Item property to access a group by its index or caption.

#Example

The following sample code obtains the index of the active group. If the active group is not the first within the collection, the first group becomes active.

Note: this example only works for those control paint styles which allow only a single expanded group at a time.

int activeGroupIndex = navBarControl1.Groups.IndexOf(navBarControl1.ActiveGroup);
if (activeGroupIndex != 0) 
   navBarControl1.ActiveGroup = navBarControl1.Groups[0];
See Also