AvaloniaList<T> Class


A notifying list.
Base Types
  • object
Derived Types
graph BT Type-->Base0["object"] Type-.->Interface0["IAvaloniaList<T>"] Type-.->Interface1["IList<T>"] Type-.->Interface2["ICollection<T>"] Type-.->Interface3["IAvaloniaReadOnlyList<T>"] Type-.->Interface4["IReadOnlyList<T>"] Type-.->Interface5["IReadOnlyCollection<T>"] Type-.->Interface6["IEnumerable<T>"] Type-.->Interface7["INotifyCollectionChanged"] Type-.->Interface8["INotifyPropertyChanged"] Type-.->Interface9["IList"] Type-.->Interface10["ICollection"] Type-.->Interface11["IEnumerable"] Type-.->Interface12["INotifyCollectionChangedDebug"] click Interface12 "/api/Avalonia.Diagnostics/INotifyCollectionChangedDebug" Type["AvaloniaList<T>"] class Type type-node Derived0["PathSegments"]-->Type click Derived0 "/api/Avalonia.Media/PathSegments" Derived1["DataTemplates"]-->Type click Derived1 "/api/Avalonia.Controls.Templates/DataTemplates" Derived2["DataGridSortDescriptionCollection"]-->Type click Derived2 "/api/Avalonia.Collections/DataGridSortDescriptionCollection" Derived3["Points"]-->Type click Derived3 "/api/Avalonia/Points" Derived4["DefinitionList<T>"]-->Type click Derived4 "/api/Avalonia.Controls/DefinitionList_1" Derived5["Transforms"]-->Type click Derived5 "/api/Avalonia.Media/Transforms" Derived6["Transitions"]-->Type click Derived6 "/api/Avalonia.Animation/Transitions" Derived7["PathFigures"]-->Type click Derived7 "/api/Avalonia.Media/PathFigures" Derived8["Classes"]-->Type click Derived8 "/api/Avalonia.Controls/Classes" Derived9["KeyFrames"]-->Type click Derived9 "/api/Avalonia.Animation/KeyFrames" Derived10["GradientStops"]-->Type click Derived10 "/api/Avalonia.Media/GradientStops" Derived11["Controls"]-->Type click Derived11 "/api/Avalonia.Controls/Controls" Derived12["Animator<T>"]-->Type click Derived12 "/api/Avalonia.Animation.Animators/Animator_1"


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


AvaloniaList is similar to System.Collections.ObjectModel.ObservableCollection<T> with a few added features:

  • It can be configured to notify the event with a action instead of a when the list is cleared by setting to . removed
  • A function can be used to validate each item before insertion. removed

Type Parameters

Name Description
T The type of the list items.


Name Summary
AvaloniaList() Initializes a new instance of the AvaloniaList<T> class.
AvaloniaList(IEnumerable<T>) Initializes a new instance of the AvaloniaList<T> class.
AvaloniaList(T[]) Initializes a new instance of the AvaloniaList<T> class.


Name Type Summary
CollectionChanged NotifyCollectionChangedEventHandler
Raised when a change is made to the collection's items.
PropertyChanged PropertyChangedEventHandler
Raised when a property on the collection changes.


Name Value Summary
Count int
Gets the number of items in the collection.
ResetBehavior ResetBehavior
Gets or sets the reset behavior of the list.
this[int] T
Gets or sets the item at the specified index.
Validate Action<T>
Gets or sets a validation routine that can be used to validate items before they are added.


Name Value Summary
Add(T) void
Adds an item to the collection.
AddRange(IEnumerable<T>) void
Adds multiple items to the collection.
Clear() void
Removes all items from the collection.
Contains(T) bool
Tests if the collection contains the specified item.
CopyTo(T[], int) void
Copies the collection's contents to an array.
GetEnumerator() AvaloniaList<T>.Enumerator
GetRange(int, int) IEnumerable<T>
Gets a range of items from the collection.
IndexOf(T) int
Gets the index of the specified item in the collection.
Insert(int, T) void
Inserts an item at the specified index.
InsertRange(int, IEnumerable<T>) void
Inserts multiple items at the specified index.
Move(int, int) void
Moves an item to a new index.
MoveRange(int, int, int) void
Moves multiple items to a new index.
Remove(T) bool
Removes an item from the collection.
RemoveAll(IEnumerable<T>) void
Removes multiple items from the collection.
RemoveAt(int) void
Removes the item at the specified index.
RemoveRange(int, int) void
Removes a range of elements from the collection.

Extension Methods

Name Value Summary
CreateDerivedList<T, TDerived>(Func<T, TDerived>) IAvaloniaReadOnlyList<TDerived>
ForEachItem<T>(Action<int, T>, Action<int, T>, Action, bool) IDisposable
Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
ForEachItem<T>(Action<T>, Action<T>, Action, bool) IDisposable
Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
TrackItemPropertyChanged<T>(Action<Tuple<object, PropertyChangedEventArgs>>) IDisposable
Listens for property changed events from all items in a collection.