Class Menu.MenuItemCollection
[ListBindable(false)]
public class Menu.MenuItemCollection : IList, ICollection, IEnumerable
- Inheritance
-
Menu.MenuItemCollection
- Implements
- Inherited Members
Constructors
MenuItemCollection(Menu)
public MenuItemCollection(Menu owner)
Parameters
owner
Menu
Properties
Count
Gets the number of elements contained in the ICollection.
public int Count { get; }
Property Value
- int
The number of elements contained in the ICollection.
IsReadOnly
Gets a value indicating whether the IList is read-only.
public bool IsReadOnly { get; }
Property Value
this[int]
public virtual MenuItem this[int index] { get; }
Parameters
index
int
Property Value
this[string]
Retrieves the child control with the specified key.
public virtual MenuItem this[string key] { get; }
Parameters
key
string
Property Value
Methods
Add(int, MenuItem)
Adds a MenuItem to this menu at the specified index. The item currently at that index, and all items after it, will be moved up one slot. MenuItems can only be contained in one menu at a time, and may not be added more than once to the same menu.
public virtual int Add(int index, MenuItem item)
Parameters
Returns
Add(string)
Adds a new MenuItem to the end of this menu with the specified caption.
public virtual MenuItem Add(string caption)
Parameters
caption
string
Returns
Add(string, EventHandler)
Adds a new MenuItem to the end of this menu with the specified caption, and click handler.
public virtual MenuItem Add(string caption, EventHandler onClick)
Parameters
caption
stringonClick
EventHandler
Returns
Add(string, MenuItem[])
Adds a new MenuItem to the end of this menu with the specified caption, click handler, and items.
public virtual MenuItem Add(string caption, MenuItem[] items)
Parameters
Returns
Add(MenuItem)
Adds a MenuItem to the end of this menu MenuItems can only be contained in one menu at a time, and may not be added more than once to the same menu.
public virtual int Add(MenuItem item)
Parameters
item
MenuItem
Returns
AddRange(MenuItem[])
public virtual void AddRange(MenuItem[] items)
Parameters
items
MenuItem[]
Clear()
Removes all existing MenuItems from this menu
public virtual void Clear()
Contains(MenuItem)
public bool Contains(MenuItem value)
Parameters
value
MenuItem
Returns
ContainsKey(string)
Returns true if the collection contains an item with the specified key, false otherwise.
public virtual bool ContainsKey(string key)
Parameters
key
string
Returns
CopyTo(Array, int)
Copies the elements of the ICollection to an Array, starting at a particular Array index.
public void CopyTo(Array dest, int index)
Parameters
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
index
is less than zero.- ArgumentException
<code class="paramref">array</code> is multidimensional.
-or-
The number of elements in the source ICollection is greater than the available space from
index
to the end of the destinationarray
.-or-
The type of the source ICollection cannot be cast automatically to the type of the destination
array
.
Find(string, bool)
Searches for Controls by their Name property, builds up an array of all the controls that match.
public MenuItem[] Find(string key, bool searchAllChildren)
Parameters
Returns
- MenuItem[]
GetEnumerator()
Returns an enumerator that iterates through a collection.
public IEnumerator GetEnumerator()
Returns
- IEnumerator
An IEnumerator object that can be used to iterate through the collection.
IndexOf(MenuItem)
public int IndexOf(MenuItem value)
Parameters
value
MenuItem
Returns
IndexOfKey(string)
The zero-based index of the first occurrence of value within the entire CollectionBase, if found; otherwise, -1.
public virtual int IndexOfKey(string key)
Parameters
key
string
Returns
Remove(MenuItem)
Removes the specified item from this menu. All subsequent items are moved down one slot.
public virtual void Remove(MenuItem item)
Parameters
item
MenuItem
RemoveAt(int)
Removes the item at the specified index in this menu. All subsequent items are moved up one slot.
public virtual void RemoveAt(int index)
Parameters
index
int
RemoveByKey(string)
Removes the menu iteml with the specified key.
public virtual void RemoveByKey(string key)
Parameters
key
string