Share via


Menu.DynamicSelectedStyle Özellik

Tanım

Kullanıcı tarafından seçilen dinamik menü öğesinin görünümünü ayarlamanıza olanak tanıyan nesneye başvuru MenuItemStyle alır.

public:
 property System::Web::UI::WebControls::MenuItemStyle ^ DynamicSelectedStyle { System::Web::UI::WebControls::MenuItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.MenuItemStyle DynamicSelectedStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.DynamicSelectedStyle : System.Web.UI.WebControls.MenuItemStyle
Public ReadOnly Property DynamicSelectedStyle As MenuItemStyle

Özellik Değeri

Seçili dinamik menü öğesinin stilini temsil eden öğesine başvuru MenuItemStyle .

Öznitelikler

Örnekler

Aşağıdaki kod örneği, seçili dinamik menü öğesi için açık mavi arka plan rengi belirtmek üzere özelliğinin nasıl kullanılacağını DynamicSelectedStyle gösterir.


<%@ 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 DynamicSelectedStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu DynamicSelectedStyle Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"
        runat="server">
        
        <dynamicselectedstyle backcolor="LightBlue"
          borderstyle="Solid"
          bordercolor="Black"
          borderwidth="1"/>
      
        <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 DynamicSelectedStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu DynamicSelectedStyle Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"
        runat="server">
        
        <dynamicselectedstyle backcolor="LightBlue"
          borderstyle="Solid"
          bordercolor="Black"
          borderwidth="1"/>
      
        <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>

Açıklamalar

Kullanıcı menüden DynamicSelectedStyle seçtiğinde dinamik menü öğesinin görünümünü denetlemek için özelliğini kullanın. Bu özellik salt okunurdur; ancak, döndürdüğü nesnenin MenuItemStyle özelliklerini ayarlayabilirsiniz. Özellikler biçiminde Property-Subpropertybildirimli olarak ayarlanabilir; burada Subproperty nesnenin MenuItemStyle bir özelliğidir (örneğin, DynamicSelectedStyle-ForeColor). Özellikler, biçiminde Property.Subproperty program aracılığıyla da ayarlanabilir (örneğin, DynamicSelectedStyle.ForeColor).

Dinamik menü öğesinin stil özellikleri aşağıdaki sırayla uygulanır:

  1. DynamicMenuStyle.

  2. DynamicMenuItemStyle. LevelMenuItemStyles Koleksiyon veya LevelSubMenuStyles koleksiyon tanımlanmışsa, diğer menü öğesi stili özellikleri geçersiz kılınarak şu anda uygulanır.

  3. DynamicSelectedStyle. LevelSelectedStyles Koleksiyon tanımlanmışsa, diğer menü öğesi stili özellikleri geçersiz kılınarak şu anda uygulanır.

  4. DynamicHoverStyle.

Şunlara uygulanır

Ayrıca bkz.