Menu.DisappearAfter Vlastnost

Definice

Získá nebo nastaví dobu, po kterou je zobrazena dynamická nabídka po ukazatel myši již není umístěn přes nabídku.

public:
 property int DisappearAfter { int get(); void set(int value); };
[System.Web.UI.Themeable(false)]
public int DisappearAfter { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.DisappearAfter : int with get, set
Public Property DisappearAfter As Integer

Hodnota vlastnosti

Doba (v milisekundách) zobrazení dynamické nabídky po umístění ukazatele myši nad nabídkou. Výchozí hodnota je 500.

Atributy

Výjimky

Vybraná hodnota je menší než -1.

Příklady

Následující příklad kódu ukazuje, jak použít DisappearAfter vlastnost k určení, že dynamická nabídka by měla zmizet poté, co uživatel přesune ukazatel myši z nabídky na více než dvě sekundy.


<%@ 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 DisappearAfter Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu DisappearAfter Example</h3>
    
      <!-- Use the DisappearAfter property to  -->
      <!-- hide the dynamic menu items if the  -->
      <!-- user moves the mouse pointer away   -->
      <!-- from the menu for two seconds.      -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="1"
        orientation="Vertical"   
        runat="server">
      
        <items>
          <asp:menuitem navigateurl="~\Home.aspx" 
            text="Home"/>
          <asp:menuitem navigateurl="~\Music.aspx"
            text="Music">
            <asp:menuitem navigateurl="~\Classical.aspx" 
              text="Classical"/>
            <asp:menuitem navigateurl="~\Rock.aspx"
              text="Rock"/>
            <asp:menuitem navigateurl="~\Jazz.aspx"
              text="Jazz"/>
          </asp:menuitem>
          <asp:menuitem navigateurl="~\Movies.aspx"
            text="Movies">
            <asp:menuitem navigateurl="~\Action.aspx"
              text="Action"/>
            <asp:menuitem navigateurl="~\Drama.aspx"
              text="Drama"/>
            <asp:menuitem navigateurl="~\SciFi.aspx"
              text="Science Fiction"/>
          </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 DisappearAfter Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu DisappearAfter Example</h3>
    
      <!-- Use the DisappearAfter property to  -->
      <!-- hide the dynamic menu items if the  -->
      <!-- user moves the mouse pointer away   -->
      <!-- from the menu for two seconds.      -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="1"
        orientation="Vertical"   
        runat="server">
      
        <items>
          <asp:menuitem navigateurl="~\Home.aspx" 
            text="Home"/>
          <asp:menuitem navigateurl="~\Music.aspx"
            text="Music">
            <asp:menuitem navigateurl="~\Classical.aspx" 
              text="Classical"/>
            <asp:menuitem navigateurl="~\Rock.aspx"
              text="Rock"/>
            <asp:menuitem navigateurl="~\Jazz.aspx"
              text="Jazz"/>
          </asp:menuitem>
          <asp:menuitem navigateurl="~\Movies.aspx"
            text="Movies">
            <asp:menuitem navigateurl="~\Action.aspx"
              text="Action"/>
            <asp:menuitem navigateurl="~\Drama.aspx"
              text="Drama"/>
            <asp:menuitem navigateurl="~\SciFi.aspx"
              text="Science Fiction"/>
          </asp:menuitem>
        </items>
      
      </asp:menu>

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

Poznámky

Ve výchozím nastavení dynamická nabídka automaticky zmizí po určité délce, když už není ukazatel myši umístěný nad nabídkou. DisappearAfter Pomocí vlastnosti určete dobu trvání.

Poznámka

Dynamická nabídka okamžitě zmizí, pokud uživatel klikne mimo nabídku.

Můžete také určit, že dynamická nabídka by nikdy neměla automaticky zmizet nastavením této vlastnosti na hodnotu -1. V tomto případě položka dynamické nabídky zmizí pouze v případě, že uživatel klikne mimo nabídku.

Tuto vlastnost nelze nastavit pomocí motivů nebo šablon stylů. Další informace najdete v tématu ThemeableAttribute a ASP.NET motivy a vzhledy.

Platí pro

Viz také