aspnet-devexpress-dot-web-dot-aspxnavbar-9eb279f2.md
Gets the style settings for all items within the navbar control.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public NavBarItemStyle ItemStyle { get; }
Public ReadOnly Property ItemStyle As NavBarItemStyle
| Type | Description |
|---|---|
| NavBarItemStyle |
A NavBarItemStyle object that contains the style settings for the navbar’s items.
|
The ItemStyle property provides access to the style settings which define the appearance style of all items within the navbar control.
A specific item style can be applied to a particular group within the navbar control by using the group’s NavBarGroup.ItemStyle property.
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);
}
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