Menu.DynamicHoverStyle Propiedad

Definición

Obtiene una referencia al objeto Style que permite establecer el aspecto de un elemento de menú dinámico cuando se sitúa encima el puntero del mouse.

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

Valor de propiedad

Style

Referencia a Style que representa el estilo de un elemento de menú dinámico cuando se sitúa encima el puntero del mouse.

Atributos

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar la propiedad para cambiar el DynamicHoverStyle color de fondo de un elemento de menú dinámico a azul cielo claro cuando el usuario coloca el puntero del mouse sobre él.


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

Comentarios

Utilice la DynamicHoverStyle propiedad para controlar la apariencia de un elemento de menú dinámico cuando el puntero del mouse se coloca sobre él. Esta propiedad es de solo lectura; sin embargo, puede establecer las propiedades del Style objeto que devuelve. Las propiedades se pueden establecer mediante declaración en el formato Property-Subproperty, donde Subproperty es una propiedad del Style objeto (por ejemplo, DynamicHoverStyle-ForeColor). Las propiedades también se pueden establecer mediante programación en el formulario Property.Subproperty (por ejemplo, DynamicHoverStyle.ForeColor).

Las propiedades de estilo de un elemento de menú dinámico se aplican en el orden siguiente:

  1. DynamicMenuStyle.

  2. DynamicMenuItemStyle. Si se define la LevelMenuItemStyles colección o LevelSubMenuStyles colección, se aplica en este momento, reemplazando las demás propiedades de estilo de elemento de menú.

  3. DynamicSelectedStyle. Si se define la LevelSelectedStyles colección, se aplica en este momento, reemplazando las demás propiedades de estilo de elemento de menú.

  4. DynamicHoverStyle.

Se aplica a

Consulte también