Back to Devexpress

NavBarControl.ActiveGroup Property

windowsforms-devexpress-dot-xtranavbar-dot-navbarcontrol-338c4a1d.md

latest3.3 KB
Original Source

NavBarControl.ActiveGroup Property

Returns an object representing the currently active group.

Namespace : DevExpress.XtraNavBar

Assembly : DevExpress.XtraNavBar.v25.2.dll

NuGet Package : DevExpress.Win

Declaration

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

Property Value

TypeDefaultDescription
NavBarGroupnull

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.

csharp
int activeGroupIndex = navBarControl1.Groups.IndexOf(navBarControl1.ActiveGroup);
if (activeGroupIndex != 0) 
   navBarControl1.ActiveGroup = navBarControl1.Groups[0];
vb
Dim ActiveGroupIndex = NavBarControl1.Groups.IndexOf(NavBarControl1.ActiveGroup)
If ActiveGroupIndex <> 0 Then
   NavBarControl1.ActiveGroup = NavBarControl1.Groups(0)
End If

See Also

NavBarGroup

Item

Groups

NavBarControl Class

NavBarControl Members

DevExpress.XtraNavBar Namespace