Bagikan melalui


Menu.DynamicHoverStyle Properti

Definisi

Mendapatkan referensi ke Style objek yang memungkinkan Anda mengatur tampilan item menu dinamis saat penunjuk mouse diposisikan di atasnya.

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

Nilai Properti

Referensi ke Style yang mewakili gaya item menu dinamis saat penunjuk mouse diposisikan di atasnya.

Atribut

Contoh

Contoh kode berikut menunjukkan cara menggunakan DynamicHoverStyle properti untuk mengubah warna latar belakang item menu dinamis menjadi biru langit terang saat pengguna memposisikan penunjuk mouse di atasnya.


<%@ 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" >

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu DynamicHoverStyle Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu DynamicHoverStyle Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"  
        runat="server">
        
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>
      
        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                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" >

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu DynamicHoverStyle Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu DynamicHoverStyle Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"  
        runat="server">
        
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>
      
        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>

Keterangan

DynamicHoverStyle Gunakan properti untuk mengontrol tampilan item menu dinamis saat penunjuk mouse diposisikan di atasnya. Properti ini bersifat baca-saja; namun, Anda dapat mengatur properti objek yang Style dikembalikannya. Properti dapat diatur secara deklaratif dalam formulir Property-Subproperty, di mana Subproperty adalah properti Style objek (misalnya, DynamicHoverStyle-ForeColor). Properti juga dapat diatur secara terprogram dalam formulir Property.Subproperty (misalnya, DynamicHoverStyle.ForeColor).

Properti gaya untuk item menu dinamis diterapkan dalam urutan berikut:

  1. DynamicMenuStyle.

  2. DynamicMenuItemStyle. LevelMenuItemStyles Jika koleksi atau LevelSubMenuStyles koleksi didefinisikan, koleksi diterapkan saat ini, menimpa properti gaya item menu lainnya.

  3. DynamicSelectedStyle. LevelSelectedStyles Jika koleksi didefinisikan, koleksi diterapkan saat ini, menimpa properti gaya item menu lainnya.

  4. DynamicHoverStyle.

Berlaku untuk

Lihat juga