Menu.LevelMenuItemStyles Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u een MenuItemStyleCollection object op dat de stijlinstellingen bevat die worden toegepast op menu-items op basis van hun niveau in een Menu besturingselement.
public:
property System::Web::UI::WebControls::MenuItemStyleCollection ^ LevelMenuItemStyles { System::Web::UI::WebControls::MenuItemStyleCollection ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.MenuItemStyleCollection LevelMenuItemStyles { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.LevelMenuItemStyles : System.Web.UI.WebControls.MenuItemStyleCollection
Public ReadOnly Property LevelMenuItemStyles As MenuItemStyleCollection
Waarde van eigenschap
Een MenuItemStyleCollection met de stijlinstellingen die worden toegepast op menu-items op basis van hun niveau in een Menu besturingselement.
- Kenmerken
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u de LevelMenuItemStyles verzameling gebruikt om stijlinstellingen toe te passen op de menu-items in een Menu besturingselement op basis van hun niveau.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Menu LevelMenuItemStyles and LevelSelectedStyles Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>Menu LevelMenuItemStyles and LevelSelectedStyles Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
target="_blank"
runat="server">
<levelmenuitemstyles>
<asp:menuitemstyle BackColor="LightSteelBlue"
forecolor="Black"/>
<asp:menuitemstyle BackColor="SkyBlue"
forecolor="Black"/>
<asp:menuitemstyle BackColor="LightSkyBlue"
forecolor="Black"/>
</levelmenuitemstyles>
<levelselectedstyles>
<asp:menuitemstyle BackColor="Cyan"
forecolor="Gray"/>
<asp:menuitemstyle BackColor="LightCyan"
forecolor="Gray"/>
<asp:menuitemstyle BackColor="PaleTurquoise"
forecolor="Gray"/>
</levelselectedstyles>
<items>
<asp:menuitem text="Home"
tooltip="Home">
<asp:menuitem text="Music"
tooltip="Music">
<asp:menuitem text="Classical"
tooltip="Classical"/>
<asp:menuitem text="Rock"
tooltip="Rock"/>
<asp:menuitem text="Jazz"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem text="Movies"
tooltip="Movies">
<asp:menuitem text="Action"
tooltip="Action"/>
<asp:menuitem text="Drama"
tooltip="Drama"/>
<asp:menuitem text="Musical"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Menu LevelMenuItemStyles and LevelSelectedStyles Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>Menu LevelMenuItemStyles and LevelSelectedStyles Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
target="_blank"
runat="server">
<levelmenuitemstyles>
<asp:menuitemstyle BackColor="LightSteelBlue"
forecolor="Black"/>
<asp:menuitemstyle BackColor="SkyBlue"
forecolor="Black"/>
<asp:menuitemstyle BackColor="LightSkyBlue"
forecolor="Black"/>
</levelmenuitemstyles>
<levelselectedstyles>
<asp:menuitemstyle BackColor="Cyan"
forecolor="Gray"/>
<asp:menuitemstyle BackColor="LightCyan"
forecolor="Gray"/>
<asp:menuitemstyle BackColor="PaleTurquoise"
forecolor="Gray"/>
</levelselectedstyles>
<items>
<asp:menuitem text="Home"
tooltip="Home">
<asp:menuitem text="Music"
tooltip="Music">
<asp:menuitem text="Classical"
tooltip="Classical"/>
<asp:menuitem text="Rock"
tooltip="Rock"/>
<asp:menuitem text="Jazz"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem text="Movies"
tooltip="Movies">
<asp:menuitem text="Action"
tooltip="Action"/>
<asp:menuitem text="Drama"
tooltip="Drama"/>
<asp:menuitem text="Musical"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
</form>
</body>
</html>
Opmerkingen
Gebruik de LevelMenuItemStyles verzameling als alternatief voor de eigenschappen van afzonderlijke stijlen (zoals DynamicMenuItemStyle) om de stijl van menu-items op de afzonderlijke niveaus van het menu te bepalen. De stijlen in deze verzameling worden toegepast op de menu-items op basis van hun menuniveau. De eerste stijl in de verzameling komt overeen met de stijl van menu-items op het eerste niveau van het menu. De tweede stijl in de verzameling komt overeen met de stijl van menu-items op het tweede niveau van het menu, enzovoort. Deze verzameling wordt meestal gebruikt voor het genereren van navigatiemenu's in inhoudsopgavestijl waarbij menu-items op een bepaald niveau hetzelfde uiterlijk moeten hebben, ongeacht of ze submenu's hebben.
Note
Als een stijl is gedefinieerd voor een bepaald niveau met behulp van de LevelMenuItemStyles verzameling, worden alle instellingen voor menu-itemstijlen voor de menu-items op dat niveau overschreven.