Skip to main content

AvaloniaList<T> Class

A notifying list.

Definition

Namespace: Avalonia.Collections
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public class AvaloniaList<T> : IAvaloniaList<T>, 
IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IAvaloniaReadOnlyList<T>,
IReadOnlyList<T>, IReadOnlyCollection<T>, INotifyCollectionChanged, INotifyPropertyChanged, IList,
ICollection

View Source
InheritanceObject → AvaloniaList(T)
DerivedAvalonia.Animation.KeyFrames
Avalonia.Animation.Transitions
Avalonia.Collections.DataGridSortDescriptionCollection
Avalonia.Controls.Classes
Avalonia.Controls.Controls
Avalonia.Controls.DefinitionList(T)
Avalonia.Controls.Documents.InlineCollection
Avalonia.Controls.Templates.DataTemplates
Avalonia.Controls.TrayIcons
Avalonia.Media.DrawingCollection
Avalonia.Media.FontFeatureCollection
Avalonia.Media.GeometryCollection
Avalonia.Media.GradientStops
Avalonia.Media.PathFigures
Avalonia.Media.PathSegments
Avalonia.Media.TextDecorationCollection
Avalonia.Media.Transforms
Avalonia.Points
ImplementsIAvaloniaList(T), IAvaloniaReadOnlyList(T), ICollection(T), IEnumerable(T), IList(T), IReadOnlyCollection(T), IReadOnlyList(T), ICollection, IEnumerable, IList, INotifyCollectionChanged, INotifyPropertyChanged

Type Parameters

The type of the list items.

Remarks

AvaloniaList is similar to ObservableCollection(T) with a few added features:

Constructors

AvaloniaList(T)()Initializes a new instance of the AvaloniaList(T) class.
AvaloniaList(T)(T[])Initializes a new instance of the AvaloniaList(T) class.
AvaloniaList(T)(IEnumerable(T))Initializes a new instance of the AvaloniaList(T) class.
AvaloniaList(T)(Int32)Initializes a new instance of the AvaloniaList(T).

Properties

CapacityGets or sets the total number of elements the internal data structure can hold without resizing.
CountGets the number of items in the collection.
Item(Int32)Gets or sets the item at the specified index.
ResetBehaviorGets or sets the reset behavior of the list.
ValidateGets or sets a validation routine that can be used to validate items before they are added.

Methods

Add(T)Adds an item to the collection.
AddRange(IEnumerable(T))Adds multiple items to the collection.
Clear()Removes all items from the collection.
Contains(T)Tests if the collection contains the specified item.
CopyTo(T[], Int32)Copies the collection's contents to an array.
EnsureCapacity(Int32)Ensures that the capacity of the list is at least Capacity.
Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize()Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetEnumerator() 
GetHashCode()Serves as the default hash function.
(Inherited from Object)
GetRange(Int32, Int32)Gets a range of items from the collection.
GetType()Gets the Type of the current instance.
(Inherited from Object)
IndexOf(T)Gets the index of the specified item in the collection.
Insert(Int32, T)Inserts an item at the specified index.
InsertRange(Int32, IEnumerable(T))Inserts multiple items at the specified index.
MemberwiseClone()Creates a shallow copy of the current Object.
(Inherited from Object)
Move(Int32, Int32)Moves an item to a new index.
MoveRange(Int32, Int32, Int32)Moves multiple items to a new index.
Remove(T)Removes an item from the collection.
RemoveAll(IEnumerable(T))Removes multiple items from the collection.
RemoveAt(Int32)Removes the item at the specified index.
RemoveRange(Int32, Int32)Removes a range of elements from the collection.
ToString()Returns a string that represents the current object.
(Inherited from Object)

Events

CollectionChangedRaised when a change is made to the collection's items.
PropertyChangedRaised when a property on the collection changes.

Extension Methods

ForEachItem(T)(Action(T), Action(T), Action, Boolean)Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
(Defined by AvaloniaListExtensions)
ForEachItem(T)(Action(Int32, T), Action(Int32, T), Action, Boolean)Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
(Defined by AvaloniaListExtensions)
GetWeakCollectionChangedObservable()Gets a weak observable for the CollectionChanged event.
(Defined by NotifyCollectionChangedExtensions)
TrackItemPropertyChanged(T)(Action(Tuple(Object, PropertyChangedEventArgs)))Listens for property changed events from all items in a collection.
(Defined by AvaloniaListExtensions)
WeakSubscribe(Action(NotifyCollectionChangedEventArgs))Subscribes to the CollectionChanged event using a weak subscription.
(Defined by NotifyCollectionChangedExtensions)
WeakSubscribe(NotifyCollectionChangedEventHandler)Subscribes to the CollectionChanged event using a weak subscription.
(Defined by NotifyCollectionChangedExtensions)

See Also

Reference

Avalonia.Collections Namespace