In This Article

OverflowMenuItemCollection Class

A collection that unions a primary menu item with above and below menu item collections.

public class OverflowMenuItemCollection : AvaloniaObject
Inheritance:
object AvaloniaObject object

Remarks

This collection can be usd as an items source in overflow menus.

Constructors

OverflowMenuItemCollection()

Initializes an instance of the class.

public OverflowMenuItemCollection()

Properties

AboveMenuItems

The collection of menu items that appear above the primary menu item.

public IEnumerable<object>? AboveMenuItems { get; set; }

Property Value

IEnumerable<object>

BelowMenuItems

The collection of menu items that appear below the primary menu item.

public IEnumerable<object>? BelowMenuItems { get; set; }

Property Value

IEnumerable<object>

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.

IsFixedSize

Gets a value indicating whether the IList has a fixed size.

public bool IsFixedSize { get; }

Property Value

bool:

true if the IList has a fixed size; otherwise, false.

IsReadOnly

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

public bool IsReadOnly { get; }

Property Value

bool:

true if the IList is read-only; otherwise, false.

IsSynchronized

Gets a value indicating whether access to the ICollection is synchronized (thread safe).

public bool IsSynchronized { get; }

Property Value

bool:

true if access to the ICollection is synchronized (thread safe); otherwise, false.

this[int]

Returns the item at the specified index.

public object? this[int index] { get; set; }
Parameter Type Description
index int

The item index.

Property Value

object:

The item at the specified index.

PrimaryMenuItem

The primary menu item.

public object? PrimaryMenuItem { get; set; }

Property Value

object

SyncRoot

Gets an object that can be used to synchronize access to the ICollection.

public object SyncRoot { get; }

Property Value

object:

An object that can be used to synchronize access to the ICollection.

Methods

Add(object?)

Adds an item to the IList.

public int Add(object? value)
Parameter Type Description
value object

The object to add to the IList.

Returns

int:

The position into which the new element was inserted, or -1 to indicate that the item was not inserted into the collection.

Exceptions

Type Condition
NotSupportedException

The IList is read-only.

-or-

The IList has a fixed size.

Clear()

Removes all items from the IList.

public void Clear()

Exceptions

Type Condition
NotSupportedException

The IList is read-only.

Contains(object?)

Determines whether the IList contains a specific value.

public bool Contains(object? value)
Parameter Type Description
value object

The object to locate in the IList.

Returns

bool:

true if the object is found in the IList; otherwise, false.

CopyTo(Array, int)

Copies the elements of the ICollection to an Array, starting at a particular Array index.

public void CopyTo(Array array, int index)
Parameter Type Description
array Array

The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.

index int

The zero-based index in array at which copying begins.

Exceptions

Type Condition
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 destination array.

-or-

The type of the source ICollection cannot be cast automatically to the type of the destination array.

GetEnumerator()

Returns an enumerator that iterates through a collection.

public IEnumerator<object?> GetEnumerator()

Returns

IEnumerator<object>:

An IEnumerator object that can be used to iterate through the collection.

IndexOf(object?)

Determines the index of a specific item in the IList.

public int IndexOf(object? value)
Parameter Type Description
value object

The object to locate in the IList.

Returns

int:

The index of value if found in the list; otherwise, -1.

Insert(int, object?)

Inserts an item to the IList at the specified index.

public void Insert(int index, object? value)
Parameter Type Description
index int

The zero-based index at which value should be inserted.

value object

The object to insert into the IList.

Exceptions

Type Condition
ArgumentOutOfRangeException

index is not a valid index in the IList.

NotSupportedException

The IList is read-only.

-or-

The IList has a fixed size.

NullReferenceException

value is null reference in the IList.

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameter Type Description
change AvaloniaPropertyChangedEventArgs

The property change details.

Remove(object?)

Removes the first occurrence of a specific object from the IList.

public void Remove(object? value)
Parameter Type Description
value object

The object to remove from the IList.

Exceptions

Type Condition
NotSupportedException

The IList is read-only.

-or-

The IList has a fixed size.

RemoveAt(int)

Removes the IList item at the specified index.

public void RemoveAt(int index)
Parameter Type Description
index int

The zero-based index of the item to remove.

Exceptions

Type Condition
ArgumentOutOfRangeException

index is not a valid index in the IList.

NotSupportedException

The IList is read-only.

-or-

The IList has a fixed size.

Events

CollectionChanged

Occurs when the collection changes.

public event NotifyCollectionChangedEventHandler? CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

Fields

AboveMenuItemsProperty

Defines the AboveMenuItems property.

public static readonly DirectProperty<OverflowMenuItemCollection, IEnumerable<object>?> AboveMenuItemsProperty

BelowMenuItemsProperty

Defines the BelowMenuItems property.

public static readonly DirectProperty<OverflowMenuItemCollection, IEnumerable<object>?> BelowMenuItemsProperty

PrimaryMenuItemProperty

Defines the PrimaryMenuItem property.

public static readonly DirectProperty<OverflowMenuItemCollection, object?> PrimaryMenuItemProperty

Inherited Members

Extension Methods