Skip to main content
A newer version of this page is available. .

NavBarControl.ActiveGroup Property

Returns an object representing the currently active group.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v18.2.dll

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];

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ActiveGroup property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also