Back to Devexpress

ASPxNavBar.GroupHeaderStyle Property

aspnet-devexpress-dot-web-dot-aspxnavbar-71343d54.md

latest3.8 KB
Original Source

ASPxNavBar.GroupHeaderStyle Property

Gets the style settings for all group headers within the navbar control.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public NavBarGroupHeaderStyle GroupHeaderStyle { get; }
vb
Public ReadOnly Property GroupHeaderStyle As NavBarGroupHeaderStyle

Property Value

TypeDescription
NavBarGroupHeaderStyle

A NavBarGroupHeaderStyle object that contains the style settings for the group headers.

|

Remarks

The GroupHeaderStyle property provides access to the style settings which define the appearance style of all group headers within the navbar control.

A specific style can be applied to the header of a particular group within the navbar control by using the group’s NavBarGroup.HeaderStyle property.

In order to define a particular header style for the collapsed state of the navbar’s groups, the ASPxNavBar.GroupHeaderStyleCollapsed property can be used.

Example

csharp
using DevExpress.Web.ASPxNavBar;
...

protected void Page_Load(object sender, EventArgs e) {
     ASPxNavBar ASPxNavBar1 = new ASPxNavBar();
     ASPxNavBar1.AutoPostBack = true;
     ASPxNavBar1.ShowExpandButtons = false;
     ASPxNavBar1.GroupHeaderStyle.HorizontalAlign = HorizontalAlign.Left;
     ASPxNavBar1.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

     NavBarGroup group1 = new NavBarGroup("Group1");
     NavBarGroup group2 = new NavBarGroup("Group2");

     NavBarItem item1 = new NavBarItem("Item1");
     NavBarItem item2 = new NavBarItem("Item2");
     NavBarItem item3 = new NavBarItem("Item3");

     ASPxNavBar1.Groups.Add(group1);
     ASPxNavBar1.Groups.Add(group2);

     group1.Items.Add(item1);
     group2.Items.Add(item2);
     group2.Items.Add(item3);

     group1.HeaderStyle.BackColor = System.Drawing.Color.White;
     group2.HeaderStyle.BackColor = System.Drawing.Color.Red;

     Page.Form.Controls.Add(ASPxNavBar1);       
}
vb
Imports DevExpress.Web.ASPxNavBar
... 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
     Dim ASPxNavBar1 As New ASPxNavBar()
     ASPxNavBar1.AutoPostBack = True
     ASPxNavBar1.ShowExpandButtons = False
     ASPxNavBar1.GroupHeaderStyle.HorizontalAlign = HorizontalAlign.Left
     ASPxNavBar1.ItemStyle.HorizontalAlign = HorizontalAlign.Center

     Dim group1 As New NavBarGroup("Group1")
     Dim group2 As New NavBarGroup("Group2")

     Dim item1 As New NavBarItem("Item1")
     Dim item2 As New NavBarItem("Item2")
     Dim item3 As New NavBarItem("Item3")

     ASPxNavBar1.Groups.Add(group1)
     ASPxNavBar1.Groups.Add(group2)

     group1.Items.Add(item1)
     group2.Items.Add(item2)
     group2.Items.Add(item3)

     group1.HeaderStyle.BackColor = System.Drawing.Color.White
     group2.HeaderStyle.BackColor = System.Drawing.Color.Red

     Page.Form.Controls.Add(ASPxNavBar1)
End Sub

See Also

HeaderStyle

GroupHeaderStyleCollapsed

Navigation Bar

ASPxNavBar Class

ASPxNavBar Members

DevExpress.Web Namespace