NavBarControl.ActiveGroup Property

Returns an object representing the currently active group.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v20.1.dll

Declaration

[DefaultValue(null)]
public NavBarGroup ActiveGroup { get; set; }
<DefaultValue(Nothing)>
Public Property ActiveGroup As NavBarGroup

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.

Examples

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