Skip to main content
Version: 4.1

MenuItemCollection

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.1.0.0)

Represents a collection of MenuItem objects.

public class MenuItemCollection : IList, ICollection, IEnumerable, IList<MenuItem>, ICollection<MenuItem>, IEnumerable<MenuItem>

Constructors

Initializes a new instance of MenuItemCollection.

NameTypeDescription
ownerMenuThe Menu object that owns the collection.

Properties

Instance member Count

Int32: Returns the number of items in the collection.

Instance member IsReadOnly

Boolean: Returns a value indicating whether this collection can be modified.

Instance member Item(index)

MenuItem: Retrieves the item at the specified index within the collection.

Throws:

Instance member Item(key)

MenuItem: Retrieves the item at the specified index within the collection.

Methods

Instance member Add(caption)

Adds an item to the list of items.

ParameterTypeDescription
captionStringThe text of the new menu item.

Returns: MenuItem.

Instance member Add(caption, onClick)

Adds an item to the list of items.

ParameterTypeDescription
captionStringThe text of the new menu item.
onClickEventHandlerAn event handler for the click event.

Returns: MenuItem.

Instance member Add(caption, items)

Adds an item to the list of items.

ParameterTypeDescription
captionStringThe text of the new menu item.
itemsMenuItem[]List of child menu items.

Returns: MenuItem.

Instance member Add(item)

Adds an item to the list of items.

ParameterTypeDescription
itemMenuItemThe new menu item.

Returns: Int32.

Instance member Add(index, item)

Adds an item to the list of items.

ParameterTypeDescription
indexInt32The index where to add/insert the new menu item.
itemMenuItemThe MenuItem to add to the collection

Returns: Int32.

Instance member AddRange(items)

Adds a collection of items to the list.

ParameterTypeDescription
itemsMenuItem[]

Instance member Clear()

Removes all items from the Menu.

Instance member Clear(dispose)

Removes and disposes all items from the Menu.

ParameterTypeDescription
disposeBooleanIndicates whether the removed items should be disposed.

Instance member Contains(value)

Determines if the specified item is located within the collection.

ParameterTypeDescription
valueMenuItemAn object representing the item to locate in the collection.

Returns: Boolean. true if the item is located within the collection; otherwise, false.

Instance member ContainsKey(key)

Determines if the specified item is located within the collection.

ParameterTypeDescription
keyStringThe key of the item to locate.

Returns: Boolean. true if the item is located within the collection; otherwise, false.

Instance member CopyTo(dest, index)

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

ParameterTypeDescription
destArrayThe object array to copy the collection to.
indexInt32The location in the destination array to copy the collection to.

Instance member Find(key, searchAllChildren)

Finds all the items with a specific key.

ParameterTypeDescription
keyStringThe key of the item to locate.
searchAllChildrenBooleanIndicates that the search should include child items.

Returns: MenuItem[].

Instance member GetEnumerator()

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

Returns: IEnumerator. A IEnumerator that represents the item collection.

Instance member IndexOf(value)

Retrieves the index within the collection of the specified item.

ParameterTypeDescription
valueMenuItemThe menu item to locate.

Returns: Int32. The zero-based index where the item is located within the collection; otherwise, -1.

Throws:

Instance member IndexOfKey(key)

Retrieves the index within the collection of the specified item.

ParameterTypeDescription
keyStringThe key for the menu item to locate.

Returns: Int32. The zero-based index where the item is located within the collection; otherwise, -1.

Instance member Remove(item)

Removes the specified item from the list.

ParameterTypeDescription
itemMenuItemThe item to remove.

Instance member RemoveAt(index)

Removes an item at the specified index.

ParameterTypeDescription
indexInt32The index of the item to remove.

Throws:

  • ArgumentOutOfRangeException The index parameter was less than zero, or the index parameter was greater than or equal to the count of items in the collection.

Instance member RemoveByKey(key)

Removes the item with the specified key.

ParameterTypeDescription
keyStringThe key of the menu item to remove.