Menu.DynamicMenuStyle プロパティ

定義

動的メニューの外観を設定できる MenuItemStyle オブジェクトへの参照を取得します。

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

プロパティ値

SubMenuStyle

動的メニューのスタイルを表す MenuItemStyle への参照。

属性

次のコード例は、プロパティを使用して、動的メニューの DynamicMenuStyle 明るい空の青の背景色を指定する方法を示しています。


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

注釈

このプロパティを DynamicMenuStyle 使用して、動的メニューの外観を制御します。 このプロパティは読み取り専用です。ただし、返されるオブジェクトのプロパティを MenuItemStyle 設定できます。 プロパティは、オブジェクトのプロパティ MenuItemStyle (たとえばDynamicMenuStyle-ForeColor) であるフォームProperty-Subproperty``Subpropertyで宣言によって設定できます。 プロパティは、プログラムでフォーム Property.Subproperty (たとえば DynamicMenuStyle.ForeColor) で設定することもできます。

動的メニュー項目のスタイル プロパティは、次の順序で適用されます。

  1. DynamicMenuStyle.

  2. DynamicMenuItemStyle. LevelMenuItemStylesコレクションまたはLevelSubMenuStylesコレクションが定義されている場合、この時点で適用され、他のメニュー項目スタイル プロパティがオーバーライドされます。

  3. DynamicSelectedStyle. コレクションが LevelSelectedStyles 定義されている場合は、この時点で適用され、他のメニュー項目スタイル プロパティがオーバーライドされます。

  4. DynamicHoverStyle.

適用対象

こちらもご覧ください