MenuItem 類別

定義

表示在 Menu 控制項中顯示的功能表項目。Represents a menu item displayed in the Menu control. 此類別無法獲得繼承。This class cannot be inherited.

public ref class MenuItem sealed : ICloneable, System::Web::UI::IStateManager
public sealed class MenuItem : ICloneable, System.Web.UI.IStateManager
type MenuItem = class
    interface IStateManager
    interface ICloneable
Public NotInheritable Class MenuItem
Implements ICloneable, IStateManager
繼承
MenuItem
實作

範例

下列範例示範如何 Menu 使用宣告式語法,將靜態 MenuItem 物件填入控制項。The following example demonstrates how to populate a Menu control with static MenuItem objects using declarative syntax.


<%@ 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>MenuItem Declarative Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItem Declarative Example</h3>
    
      <!-- Use declarative syntax to create the   -->
      <!-- menu structure. Create submenu items   -->
      <!-- by nesting them within parent menu     -->
      <!-- items.                                 -->
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical" 
        target="_blank"  
        runat="server">

        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            imageurl="Images\Home.gif"
            popoutimageurl="Images\Popout.jpg"   
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              popoutimageurl="Images\Popout.jpg"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              popoutimageurl="Images\Popout.jpg"              
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                separatorimageurl="Images\Separator.jpg"
                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>MenuItem Declarative Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItem Declarative Example</h3>
    
      <!-- Use declarative syntax to create the   -->
      <!-- menu structure. Create submenu items   -->
      <!-- by nesting them within parent menu     -->
      <!-- items.                                 -->
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical" 
        target="_blank"  
        runat="server">

        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            imageurl="Images\Home.gif"
            popoutimageurl="Images\Popout.jpg"   
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              popoutimageurl="Images\Popout.jpg"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              popoutimageurl="Images\Popout.jpg"              
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

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

下列範例示範如何將控制項系結 MenuSiteMapDataSource 控制項。The following example demonstrates how to bind a Menu control to a SiteMapDataSource control. 系結至資料來源時, Menu 控制項會自動建立 MenuItem 物件。When bound to a data source, the Menu control automatically creates the MenuItem objects. 為了讓此範例正常運作,您必須將下列範例網站地圖資料複製到名為 web.sitemap 的檔案。For this example to work correctly, you must copy the sample site map data below to a file named Web.sitemap.


<%@ 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 DataBinding Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu DataBinding Example</h3>
    
      <!-- Bind the Menu control to a SiteMapDataSource control.  -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"
        datasourceid="MenuSource"   
        runat="server">
        
        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>

      </asp:menu>
      
      <asp:SiteMapDataSource id="MenuSource"
        runat="server"/>        

    </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 DataBinding Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu DataBinding Example</h3>
    
      <!-- Bind the Menu control to a SiteMapDataSource control.  -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"
        datasourceid="MenuSource"   
        runat="server">
        
        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>

      </asp:menu>
      
      <asp:SiteMapDataSource id="MenuSource"
        runat="server"/>        

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

以下是前一個範例的網站地圖資料範例。The following is sample site map data for the previous example.

<siteMap>

<siteMapNode url="~\Home.aspx"

title="Home"

description="Home">

<siteMapNode url="~\Music.aspx"

title="Music"

description="Music">

<siteMapNode url="~\Classical.aspx"

title="Classical"

description="Classical"/>

<siteMapNode url="~\Rock.aspx"

title="Rock"

description="Rock"/>

<siteMapNode url="~\Jazz.aspx"

title="Jazz"

description="Jazz"/>

</siteMapNode>

<siteMapNode url="~\Movies.aspx"

title="Movies"

description="Movies">

<siteMapNode url="~\Action.aspx"

title="Action"

description="Action"/>

<siteMapNode url="~\Drama.aspx"

title="Drama"

description="Drama"/>

<siteMapNode url="~\Musical.aspx"

title="Musical"

description="Musical"/>

</siteMapNode>

</siteMapNode>

</siteMap>

備註

Menu控制項是由物件所代表的功能表項目階層所組成 MenuItemA Menu control is made up of a hierarchy of menu items represented by MenuItem objects. 每個功能表項目都有唯讀 Depth 屬性,可指定控制項中顯示功能表項目的層級 MenuEach menu item has a read-only Depth property that specifies the level at which the menu item is displayed in the Menu control. 最上層的功能表項目 (層級 0) 沒有父功能表項目,就稱為根功能表項目。Menu items at the top level (level 0) that do not have a parent menu item are called root menu items. 具有父功能表項目的功能表項目稱為子功能表專案。A menu item that has a parent menu item is called a submenu item. 所有根功能表項目都會儲存在 Items 集合中。All root menu items are stored in the Items collection. 子功能表專案會儲存在父功能表項目的 ChildItems 集合中。Submenu items are stored in a parent menu item's ChildItems collection. 您可以使用屬性來存取功能表項目的父功能表項目 ParentYou can access a menu item's parent menu item by using the Parent property.

注意

ItemsChildItems 集合只包含下一個層級下的功能表項目。The Items and ChildItems collections contain only the menu items for the next level down. 若要在功能表樹狀結構中進一步存取功能表項目,請使用 ChildItems 後續功能表項目的屬性。To access menu items further down the menu tree, use the ChildItems property of a subsequent menu item.

若要建立控制項的功能表項目 Menu ,請使用下列其中一種方法:To create the menu items for a Menu control, use one of the following methods:

使用宣告式語法來建立靜態功能表項目。Use declarative syntax to create static menu items.

使用函式來動態建立類別的新實例 MenuItemUse a constructor to dynamically create new instances of the MenuItem class. MenuItem然後可以將這些物件加入至 ItemsChildItems 集合。These MenuItem objects can then be added to the Items or ChildItems collection.

將控制項系結 Menu 至資料來源。Bind the Menu control to a data source. 當控制項系結 Menu 至控制項時 SiteMapDataSource ,會 MenuItem 自動建立對應至資料來源中專案的物件。When the Menu control is bound to a SiteMapDataSource control, MenuItem objects are automatically created that correspond to the items in the data source. 若為其他資料來源, MenuItem 也會自動建立符合資料來源之階層結構的物件; 不過,您也必須使用 DataBindings 集合來定義功能表項目系結,以指定功能表項目與其對應資料項目之間的系結關聯性。For other data sources, MenuItem objects are also automatically created that match the hierarchy structure of data source; however, you must also use the DataBindings collection to define the menu item bindings that specify the binding relationship between a menu item and its corresponding data item.

功能表項目會顯示在靜態功能表或動態功能表中,視其層級而定。The menu items are displayed in either a static menu or a dynamic menu, depending on its level. 靜態功能表一律會顯示在控制項中 MenuThe static menu is always displayed in a Menu control. 依預設,位於最上層 (層級 0) 的功能表項目會顯示在靜態功能表中。By default, the menu items at the top level (level 0) are displayed in the static menu. 您可以藉由設定屬性,在靜態功能表中顯示 (靜態子功能表) 的其他功能表層級 StaticDisplayLevelsYou can display additional menu levels (static submenus) within the static menu by setting the StaticDisplayLevels property. 如果有任何) 的層級高於屬性指定的值,則功能表項目 (StaticDisplayLevels 會顯示在動態子功能表中。Menu items (if any) with a higher level than the value specified by the StaticDisplayLevels property are displayed in a dynamic submenu. 只有當使用者將滑鼠指標放在包含動態子功能表的父功能表項目上方時,才會顯示動態子功能表。A dynamic submenu appears only when the user positions the mouse pointer over the parent menu item that contains a dynamic submenu.

當使用者按一下功能表項目時, Menu 控制項可以流覽至連結的網頁,或直接回傳至伺服器。When the user clicks a menu item, the Menu control can either navigate to a linked Web page or simply post back to the server. 如果 NavigateUrl 已設定功能表項目的屬性, Menu 控制項會流覽至連結的頁面; 否則,它會將頁面張貼回伺服器進行處理。If the NavigateUrl property of a menu item is set, the Menu control navigates to the linked page; otherwise, it posts the page back to the server for processing. 根據預設,連結的頁面會顯示在與控制項相同的視窗或框架中 MenuBy default, a linked page is displayed in the same window or frame as the Menu control. 若要將連結的內容顯示在不同的視窗或框架中,請使用 Target 控制項的屬性 MenuTo display the linked content in a different window or frame, use the Target property of the Menu control.

注意

Menu.Target屬性會影響控制項中的每個功能表項目。The Menu.Target property affects every menu item in the control. 若要指定個別功能表項目的視窗或框架,請直接設定 Target 物件的屬性 MenuItemTo specify a window or frame for an individual menu item, set the Target property of the MenuItem object directly.

每個功能表項目都有 TextValue 屬性。Each menu item has a Text and a Value property. 屬性的值 Text 會顯示在 Menu 控制項中,而 Value 屬性則是用來儲存功能表項目的任何其他資料,例如傳遞給與功能表項目相關聯之回傳事件的資料。The value of the Text property is displayed in the Menu control, while the Value property is used to store any additional data about the menu item, such as data passed to the postback event associated with the menu item. 如果您設定 Text 屬性,但將屬性保留 Value 為未設定,則 Value 會自動將屬性設定為與屬性相同的值 TextIf you set the Text property, but leave the Value property unset, the Value property is automatically set with the same value as the Text property. 反之亦然。The opposite is also true. 如果您設定屬性 Value ,而不 Text 是屬性,則 Text 會自動將屬性設定為與屬性相同的值 ValueIf you set the Value property, but not the Text property, the Text property is automatically set with the same value as the Value property.

注意

相同功能表層級上的功能表項目都必須各自具有唯一的 Value 屬性值; Menu 控制項無法分辨相同層級上具有相同值的不同功能表項目。Menu items at the same menu level must each have a unique value for the Value property; the Menu control cannot distinguish between different menu items at the same level that have the same value. 在此案例中,如果使用者按一下具有重複值的功能表項目,則會選取功能表中第一個出現的功能表項目。In this scenario, if the user clicks a menu item that has a duplicate value, the menu item that appears first in the menu is selected.

若要在使用者將滑鼠指標置於功能表項目上方時顯示工具提示,請設定專案的 ToolTip 屬性。To display a ToolTip when the user positions the mouse pointer over a menu item, set the item's ToolTip property.

Menu控制項有數種不同類型的功能表項目。A Menu control has several different types of menu items. 您可以使用下表中的屬性,來控制不同功能表項目類型的樣式 (例如字型大小和色彩) 。You can control the style (such as font size and color) for the different menu item types by using the properties in the following table.

功能表項目樣式屬性Menu item style property 描述Description
DynamicHoverStyle 當滑鼠指標位於動態功能表項目上時,動態功能表項目的樣式設定。The style settings for a dynamic menu item when the mouse pointer is positioned over it.
DynamicMenuItemStyle 個別動態功能表項目的樣式設定。The style settings for an individual dynamic menu item.
DynamicMenuStyle 動態功能表的樣式設定。The style settings for a dynamic menu.
DynamicSelectedStyle 目前選取之動態功能表項目的樣式設定。The style settings for the currently selected dynamic menu item.
StaticHoverStyle 當滑鼠指標位於靜態功能表項目上時,該專案的樣式設定。The style settings for a static menu item when the mouse pointer is positioned over it.
StaticMenuItemStyle 個別靜態功能表項目的樣式設定。The style settings for an individual static menu item.
StaticMenuStyle 靜態功能表的樣式設定。The style settings for a static menu.
StaticSelectedStyle 目前選取之靜態功能表項目的樣式設定。The style settings for the currently selected static menu item.

您可以使用下表所示的樣式集合,根據專案的層級,指定套用至功能表項目的樣式,而不是設定個別的樣式屬性。Instead of setting the individual style properties, you can specify styles that are applied to menu items based on their level by using the style collections shown in the following table.

層級樣式集合Level style collections 描述Description
LevelMenuItemStyles 物件的集合 MenuItemStyle ,這些物件會根據功能表項目的層級來控制功能表項目的樣式。A collection of MenuItemStyle objects that control the style of the menu items based on their level.
LevelSelectedStyles 物件的集合 MenuItemStyle ,這些物件會根據所選功能表項目的層級來控制其樣式。A collection of MenuItemStyle objects that control the style of selected menu items based on their level.
LevelSubMenuStyles 物件的集合 MenuItemStyle ,這些物件會根據子功能表專案的層級來控制其子專案的樣式。A collection of MenuItemStyle objects that control the style of the submenu items based on their level.

集合中的第一個樣式對應至功能表樹狀結構中第一個深度層級的功能表項目樣式。The first style in the collection corresponds to the style of the menu items at the first depth level in the menu tree. 集合中的第二個樣式對應至功能表樹狀結構中第二個深度層級的功能表項目樣式,依此類推。The second style in the collection corresponds to the style of the menu items at the second depth level in the menu tree, and so on. 這最常用於產生目錄樣式的導覽功能表,在特定深度的功能表項目應該具有相同的外觀,不論是否有子功能表。This is most often used to generate table of contents-style navigation menus where menu items at a certain depth should have the same appearance, regardless of whether they have submenus.

注意

如果您使用上表所列的任何層級樣式集合來定義控制項的樣式,則 Menu 這些樣式設定會覆寫個別的功能表項目樣式屬性。If you use any of the level style collections listed in the previous table to define the style for the Menu control, these style settings override the individual menu item style properties.

除了自訂功能表項目的樣式之外,您也可以自訂其外觀。In addition to customizing a menu item's style, you can also customize its appearance. 您可以藉由設定下表中的屬性,為功能表項目的不同部分指定自訂影像。You can specify custom images for the different parts for a menu item by setting the properties in the following table.

影像屬性Image property 描述Description
ImageUrl 在功能表項目的文字旁邊顯示的選擇性影像。An optional image displayed next to the text of a menu item.
PopOutImageUrl 顯示在功能表項目中的選擇性影像,指出功能表項目有動態子功能表。An optional image displayed in a menu item to indicate that the menu item has a dynamic submenu.
SeparatorImageUrl 顯示在功能表項目底部的選擇性影像,可將它與其他功能表項目隔開。An optional image displayed at the bottom of a menu item to separate it from other menu items.

若要判斷目前是否已在控制項中選取功能表項目 Menu ,請使用 Selected 屬性。To determine whether a menu item is currently selected in a Menu control, use the Selected property. 您也可以使用屬性來判斷是否要將功能表項目系結至資料 DataBoundYou can also determine whether a menu item is bound to data by using the DataBound property. 如果功能表項目系結至資料,您可以使用 DataItem 屬性來存取系結至功能表項目的資料項目值。If a menu item is bound to data, you can use the DataItem property to access the values of the data item bound to the menu item.

如需 MenuItem 類別之執行個體的初始屬性值清單,請參閱 MenuItem 建構函式。For a list of initial property values for an instance of the MenuItem class, see the MenuItem constructor.

建構函式

MenuItem()

不以功能表文字或值,初始化 MenuItem 類別的新執行個體。Initializes a new instance of the MenuItem class without menu text or a value.

MenuItem(String)

使用指定的功能表文字,初始化 MenuItem 類別的新執行個體。Initializes a new instance of the MenuItem class using the specified menu text.

MenuItem(String, String)

使用指定的功能表文字和值,初始化 MenuItem 類別的新執行個體。Initializes a new instance of the MenuItem class using the specified menu text and value.

MenuItem(String, String, String)

使用指定的功能表文字、值和影像的 URL,初始化 MenuItem 類別的新執行個體。Initializes a new instance of the MenuItem class using the specified menu text, value, and URL to an image.

MenuItem(String, String, String, String)

使用指定的功能表文字、值、影像 URL 和巡覽 URL,初始化 MenuItem 類別的新執行個體。Initializes a new instance of the MenuItem class using the specified menu text, value, image URL, and navigation URL.

MenuItem(String, String, String, String, String)

使用指定的功能表文字、值、影像 URL、巡覽 URL 和目標,初始化 MenuItem 類別的新執行個體。Initializes a new instance of the MenuItem class using the specified menu text, value, image URL, navigation URL, and target.

屬性

ChildItems

取得 MenuItemCollection 物件,其中含有目前功能表項目的子功能表項目。Gets a MenuItemCollection object that contains the submenu items of the current menu item.

DataBound

取得值,指出功能表項目是否透過資料繫結所建立。Gets a value indicating whether the menu item was created through data binding.

DataItem

取得繫結至功能表項目的資料項目。Gets the data item that is bound to the menu item.

DataPath

取得繫結至功能表項目之資料的路徑。Gets the path to the data that is bound to the menu item.

Depth

取得顯示功能表項目的層級。Gets the level at which a menu item is displayed.

Enabled

取得或設定值,指出 MenuItem 物件是否已啟用,讓項目能夠顯示快顯影像及任何子功能表項目。Gets or sets a value that indicates whether the MenuItem object is enabled, allowing the item to display a pop-out image and any child menu items.

ImageUrl

取得或設定顯示在功能表項目文字旁的影像之 URL。Gets or sets the URL to an image that is displayed next to the text in a menu item.

NavigateUrl

取得或設定在按一下功能表項目時所要巡覽的 URL。Gets or sets the URL to navigate to when the menu item is clicked.

Parent

取得目前功能表項目的父功能表項目。Gets the parent menu item of the current menu item.

PopOutImageUrl

取得或設定顯示在功能表項目中之影像的 URL,表示該功能表項目具有動態子功能表。Gets or sets the URL to an image that is displayed in a menu item to indicate that the menu item has a dynamic submenu.

Selectable

取得或設定值,指出 MenuItem 物件是否可選取,或是否為「可點選」。Gets or sets a value that indicates whether the MenuItem object can be selected, or is "clickable."

Selected

取得或設定值,指出目前的功能表項目是否已在 Menu 控制項中選取。Gets or sets a value indicating whether the current menu item is selected in a Menu control.

SeparatorImageUrl

取得或設定顯示在功能表項目底部,以便與其他功能表項目隔開之影像的 URL。Gets or sets the URL to an image displayed at the bottom of a menu item to separate it from other menu items.

Target

取得或設定要顯示與功能表項目關聯之 Web 網頁內容的目標視窗或框架。Gets or sets the target window or frame in which to display the Web page content associated with a menu item.

Text

取得或設定針對 Menu 控制項中的功能表項目所顯示之文字。Gets or sets the text displayed for the menu item in a Menu control.

ToolTip

取得或設定功能表項目的工具提示文字。Gets or sets the ToolTip text for the menu item.

Value

取得或設定非顯示值,這個值是用來儲存與功能表項目相關的其他資料,例如用來處理回傳事件的資料。Gets or sets a non-displayed value used to store any additional data about the menu item, such as data used for handling postback events.

ValuePath

取得從根功能表項目通往目前功能表項目的路徑。Gets the path from the root menu item to the current menu item.

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

ICloneable.Clone()

建立目前 MenuItem 物件的複本。Creates a copy of the current MenuItem object.

IStateManager.IsTrackingViewState

取得值,指出 MenuItem 物件是否正在儲存變更至它的檢視狀態。Gets a value that indicates whether the MenuItem object is saving changes to its view state.

IStateManager.LoadViewState(Object)

載入功能表項目先前儲存的檢視狀態。Loads the menu item's previously saved view state.

IStateManager.SaveViewState()

將檢視狀態的變更儲存至 ObjectSaves the view-state changes to an Object.

IStateManager.TrackViewState()

指示 MenuItem 物件追蹤其檢視狀態的變更。Instructs the MenuItem object to track changes to its view state.

適用於

另請參閱