Menu.MenuItemCollection Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
[<System.ComponentModel.ListBindable(false)>]
type Menu.MenuItemCollection = class
interface IList
interface ICollection
interface IEnumerable
Public Class Menu.MenuItemCollection
Implements IList
- Inheritance
-
Menu.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) |
Initializes a new instance of the Menu.MenuItemCollection class. |
Properties
Count |
Gets a value indicating the total number of MenuItem objects in the collection. |
IsReadOnly |
Gets a value indicating whether the collection is read-only. |
Item[Int32] |
Retrieves the MenuItem at the specified indexed location in the collection. |
Item[String] |
Gets an item with the specified key from the collection. |
Methods
Add(Int32, MenuItem) |
Adds a previously created MenuItem at the specified index within the menu item collection. |
Add(MenuItem) |
Adds a previously created MenuItem to the end of the current menu. |
Add(String) |
Adds a new MenuItem, to the end of the current menu, with a specified caption. |
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[]) |
Adds a new MenuItem to the end of this menu with the specified caption, Click event handler, and items. |
AddRange(MenuItem[]) |
Adds an array of previously created MenuItem objects to the collection. |
Clear() |
Removes all MenuItem objects from the menu item collection. |
Contains(MenuItem) |
Determines if the specified MenuItem is a member of the collection. |
ContainsKey(String) |
Determines whether the collection contains an item with the specified key. |
CopyTo(Array, Int32) |
Copies the entire collection into an existing array at a specified location within the array. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Find(String, Boolean) |
Finds the items with the specified key, optionally searching the submenu items. |
GetEnumerator() |
Returns an enumerator that can be used to iterate through the menu item collection. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
IndexOf(MenuItem) |
Retrieves the index of a specific item in the collection. |
IndexOfKey(String) |
Finds the index of the first occurrence of a menu item with the specified key. |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
Remove(MenuItem) |
Removes the specified MenuItem from the menu item collection. |
RemoveAt(Int32) |
Removes a MenuItem from the menu item collection at a specified index. |
RemoveByKey(String) |
Removes the menu item with the specified key from the collection. |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Explicit Interface Implementations
ICollection.IsSynchronized |
For a description of this member, see IsSynchronized. |
ICollection.SyncRoot |
For a description of this member, see SyncRoot. |
IList.Add(Object) |
For a description of this member, see Add(Object). |
IList.Contains(Object) |
For a description of this member, see Contains(Object). |
IList.IndexOf(Object) |
For a description of this member, see IndexOf(Object). |
IList.Insert(Int32, Object) |
For a description of this member, see Insert(Int32, Object). |
IList.IsFixedSize |
For a description of this member, see IsFixedSize. |
IList.Item[Int32] |
For a description of this member, see Item[Int32]. |
IList.Remove(Object) |
For a description of this member, see Remove(Object). |
Extension Methods
Cast<TResult>(IEnumerable) |
Casts the elements of an IEnumerable to the specified type. |
OfType<TResult>(IEnumerable) |
Filters the elements of an IEnumerable based on a specified type. |
AsParallel(IEnumerable) |
Enables parallelization of a query. |
AsQueryable(IEnumerable) |
Converts an IEnumerable to an IQueryable. |