Skip to main content
Version: 3.5

MenuItemCollection

Namespace: Wisej.Web

Assembly: Wisej.Framework (3.5.0.0)

Represents a collection of MenuItem objects.

public class MenuItemCollection : IList, ICollection, IEnumerable

Constructors

Initializes a new instance of MenuItemCollection.

NameTypeDescription
ownerMenuThe Menu object that owns the collection.

Properties

Instance memberCount

Int32: Returns the number of items in the collection.

Instance memberIsReadOnly

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

Instance memberItem(index)

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

Throws:

Instance memberItem(key)

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

Methods

Instance memberAdd(caption)

Adds an item to the list of items.

ParameterTypeDescription
captionStringThe text of the new menu item.

Returns: MenuItem.

Instance memberAdd(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 memberAdd(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 memberAdd(item)

Adds an item to the list of items.

ParameterTypeDescription
itemMenuItemThe new menu item.

Returns: Int32.

Instance memberAdd(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 memberAddRange(items)

Adds a collection of items to the list.

ParameterTypeDescription
itemsMenuItem[]

Instance memberClear()

Removes all items from the Menu.

Instance memberClear(dispose)

Removes and disposes all items from the Menu.

ParameterTypeDescription
disposeBooleanIndicates whether the removed items should be disposed.

Instance memberContains(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 memberContainsKey(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 memberCopyTo(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 memberFind(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 memberGetEnumerator()

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

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

Instance memberIndexOf(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 memberIndexOfKey(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 memberRemove(item)

Removes the specified item from the list.

ParameterTypeDescription
itemMenuItemThe item to remove.

Instance memberRemoveAt(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 memberRemoveByKey(key)

Removes the item with the specified key.

ParameterTypeDescription
keyStringThe key of the menu item to remove.