Menu.DynamicSelectedStyle プロパティ

定義

ユーザーが選択した動的メニュー項目の外観を設定できる、MenuItemStyle オブジェクトへの参照を取得します。

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

プロパティ値

MenuItemStyle

選択された動的メニュー項目のスタイルを表す MenuItemStyle への参照。

属性

次のコード例は、プロパティを DynamicSelectedStyle 使用して、選択した動的メニュー項目の水色の背景色を指定する方法を示しています。


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

注釈

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

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

  1. DynamicMenuStyle.

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

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

  4. DynamicHoverStyle.

適用対象

こちらもご覧ください