Редагувати

Поділитися через


MenuItemCollection Constructors

Definition

Initializes a new instance of the MenuItemCollection class.

Overloads

MenuItemCollection()

Initializes a new instance of the MenuItemCollection class using the default values.

MenuItemCollection(MenuItem)

Initializes a new instance of the MenuItemCollection class using the specified parent menu item (or owner).

MenuItemCollection()

Initializes a new instance of the MenuItemCollection class using the default values.

public:
 MenuItemCollection();
public MenuItemCollection ();
Public Sub New ()

Remarks

Use this constructor to initialize a new instance of the MenuItemCollection class using the default values. This constructor is commonly used when creating a collection of root menu items where a parent menu (or owner) is not required.

Note

When creating a collection of child menu items, you should use the overloaded constructor that takes the owner parameter, instead of this constructor, to specify the parent menu item.

This constructor is used primarily by control developers when extending the Menu control to initialize the Items property.

See also

Applies to

MenuItemCollection(MenuItem)

Initializes a new instance of the MenuItemCollection class using the specified parent menu item (or owner).

public:
 MenuItemCollection(System::Web::UI::WebControls::MenuItem ^ owner);
public MenuItemCollection (System.Web.UI.WebControls.MenuItem owner);
new System.Web.UI.WebControls.MenuItemCollection : System.Web.UI.WebControls.MenuItem -> System.Web.UI.WebControls.MenuItemCollection
Public Sub New (owner As MenuItem)

Parameters

owner
MenuItem

A MenuItem that represents the parent menu item of the current MenuItemCollection.

Remarks

Use this constructor to initialize a new instance of the MenuItemCollection class using the specified parent menu item (or owner). This constructor is commonly used when creating a collection of child menu items where you need to specify the parent menu item.

Note

When creating a collection of root menu items, consider using the parameterless constructor because root menu items do not have a parent menu item.

This constructor is used primarily by control developers when extending the MenuItem class to initialize the ChildItems property.

See also

Applies to