Menu.MenuItemCollection Menu.MenuItemCollection Menu.MenuItemCollection Menu.MenuItemCollection Class

Definition

Represents a collection of MenuItem objects.

public: ref class Menu::MenuItemCollection : System::Collections::IList
[System.ComponentModel.ListBindable(false)]
public class Menu.MenuItemCollection : System.Collections.IList
type Menu.MenuItemCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class Menu.MenuItemCollection
Implements IList
Inheritance
Menu.MenuItemCollectionMenu.MenuItemCollectionMenu.MenuItemCollectionMenu.MenuItemCollection
Attributes
Implements

Remarks

This class represents the collection of MenuItem objects stored in a MainMenu, ContextMenu, or MenuItem. For the MainMenu and ContextMenu classes, this collection represents the entire menu structure for the control. For the MenuItem class, this collection represents the list of submenu items associated with the MenuItem.

The Add and Remove methods enable you to add and remove individual menu items from the collection. You can also use the Clear method to remove all the menu items from the collection.

Constructors

Menu.MenuItemCollection(Menu) Menu.MenuItemCollection(Menu) Menu.MenuItemCollection(Menu) Menu.MenuItemCollection(Menu)

Initializes a new instance of the Menu.MenuItemCollection class.

Properties

Count Count Count Count

Gets a value indicating the total number of MenuItem objects in the collection.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Gets a value indicating whether the collection is read-only.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Retrieves the MenuItem at the specified indexed location in the collection.

Item[String] Item[String] Item[String] Item[String]

Gets an item with the specified key from the collection.

Methods

Add(Int32, MenuItem) Add(Int32, MenuItem) Add(Int32, MenuItem) Add(Int32, MenuItem)

Adds a previously created MenuItem at the specified index within the menu item collection.

Add(MenuItem) Add(MenuItem) Add(MenuItem) Add(MenuItem)

Adds a previously created MenuItem to the end of the current menu.

Add(String) Add(String) Add(String) Add(String)

Adds a new MenuItem, to the end of the current menu, with a specified caption.

Add(String, EventHandler) Add(String, EventHandler) Add(String, EventHandler) Add(String, EventHandler)

Adds a new MenuItem to the end of the current menu with a specified caption and a specified event handler for the Click event.

Add(String, MenuItem[]) Add(String, MenuItem[]) Add(String, MenuItem[]) Add(String, MenuItem[])

Adds a new MenuItem to the end of this menu with the specified caption, Click event handler, and items.

AddRange(MenuItem[]) AddRange(MenuItem[]) AddRange(MenuItem[]) AddRange(MenuItem[])

Adds an array of previously created MenuItem objects to the collection.

Clear() Clear() Clear() Clear()

Removes all MenuItem objects from the menu item collection.

Contains(MenuItem) Contains(MenuItem) Contains(MenuItem) Contains(MenuItem)

Determines if the specified MenuItem is a member of the collection.

ContainsKey(String) ContainsKey(String) ContainsKey(String) ContainsKey(String)

Determines whether the collection contains an item with the specified key.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

Copies the entire collection into an existing array at a specified location within the array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Find(String, Boolean) Find(String, Boolean) Find(String, Boolean) Find(String, Boolean)

Finds the items with the specified key, optionally searching the submenu items

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that can be used to iterate through the menu item collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexOf(MenuItem) IndexOf(MenuItem) IndexOf(MenuItem) IndexOf(MenuItem)

Retrieves the index of a specific item in the collection.

IndexOfKey(String) IndexOfKey(String) IndexOfKey(String) IndexOfKey(String)

Finds the index of the first occurrence of a menu item with the specified key.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(MenuItem) Remove(MenuItem) Remove(MenuItem) Remove(MenuItem)

Removes the specified MenuItem from the menu item collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes a MenuItem from the menu item collection at a specified index.

RemoveByKey(String) RemoveByKey(String) RemoveByKey(String) RemoveByKey(String)

Removes the menu item with the specified key from the collection.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

For a description of this member, see IsSynchronized.

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

For a description of this member, see SyncRoot.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

For a description of this member, see Add(Object).

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

For a description of this member, see Contains(Object).

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

For a description of this member, see IndexOf(Object).

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

For a description of this member, see Insert(Int32, Object).

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

For a description of this member, see IsFixedSize.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

For a description of this member, see Item[Int32].

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

For a description of this member, see Remove(Object).

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to