Share via


Menu.StaticItemFormatString プロパティ

定義

静的に表示されるすべてのメニュー項目と共に表示される追加テキストを取得または設定します。

public:
 property System::String ^ StaticItemFormatString { System::String ^ get(); void set(System::String ^ value); };
public string StaticItemFormatString { get; set; }
member this.StaticItemFormatString : string with get, set
Public Property StaticItemFormatString As String

プロパティ値

すべてのメニュー項目と共に表示される追加のテキストまたは文字。 このプロパティの既定値は "{0}." です。

次のコード例では、 プロパティと DynamicItemFormatString プロパティを使用StaticItemFormatStringして各メニュー項目にテキストを追加する方法を示します。


<%@ 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 StaticItemFormatString and DynamicItemFormatString Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu StaticItemFormatString and DynamicItemFormatString Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"  
        runat="server"
        StaticItemFormatString="To Go to: {0}"
        DynamicItemFormatString="Click here: {0}">
        
        <dynamicmenustyle backcolor="LightSkyBlue"
          forecolor="Black"
          borderstyle="Solid"
          borderwidth="1"
          bordercolor="Black" />
      
        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            tooltip="Home"
              Selectable="false">
            <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"
              Enabled="false">
              <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 StaticItemFormatString and DynamicItemFormatString Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu StaticItemFormatString and DynamicItemFormatString Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"  
        runat="server"
        StaticItemFormatString="To Go to: {0}"
        DynamicItemFormatString="Click here: {0}">
        
        <dynamicmenustyle backcolor="LightSkyBlue"
          forecolor="Black"
          borderstyle="Solid"
          borderwidth="1"
          bordercolor="Black" />
      
        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            tooltip="Home"
              Selectable="false">
            <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"
              Enabled="false">
              <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>

注釈

このプロパティを使用すると、メニュー内の静的メニュー項目の書式を設定するテキストを挿入できます。 これは、モバイル デバイスで特に役立ちます。 コントロールでは Menu 、静的メニュー項目と動的メニュー項目の表示用のテンプレートがサポートされていますが、モバイル デバイスではテンプレートは無視されます。 このプロパティを使用すると、文字またはテキストを追加したり、テンプレートを使用せずにモバイル デバイスとデスクトップ デバイスの両方のメニュー項目に書式を適用したりできます。

注意

このプロパティを使用するときに一貫した書式設定を実現するには、静的メニュー項目と動的メニュー項目の間で書式設定を同じにする場合は、 プロパティも設定 DynamicItemFormatString する必要があります。

テンプレートの書式設定とこのプロパティの両方が適用されている場合、モバイル デバイスではテンプレートの書式設定は無視されます。

適用対象

こちらもご覧ください