ItemCollection Class
Definition
Holds the list of items that constitute the content of an Avalonia.Controls.ItemsControl.
public class ItemCollection
Methods
| Name | Description |
|---|---|
| Add | Adds an item to the Avalonia.Controls.ItemsControl. |
| Clear | Clears the collection and releases the references on all items currently in the collection. |
| Insert | Inserts an element into the collection at the specified index. |
| Remove | Removes the specified item reference from the collection or view. |
| RemoveAt | Removes the item at the specified index of the collection or view. |
| Contains | Inherited from ItemsSourceView. |
| GetAt | Retrieves the item at the specified index. Inherited from ItemsSourceView. |
| GetEnumerator | Inherited from ItemsSourceView. |
| GetOrCreate (2 overloads) | Inherited from ItemsSourceView. |
| IndexOf | Inherited from ItemsSourceView. |
Add Method
Adds an item to the Avalonia.Controls.ItemsControl.
public int Add(object value)
Parameters
value object
The item to add to the collection.
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
Clear Method
Clears the collection and releases the references on all items currently in the collection.
public void Clear()
Exceptions
Insert Method
Inserts an element into the collection at the specified index.
public void Insert(int index, object value)
Parameters
index int
The zero-based index at which to insert the item.
value object
The item to insert.
Exceptions
Remove Method
Removes the specified item reference from the collection or view.
public bool Remove(object value)
Parameters
value object
The object to remove.
Returns
bool
True if the item was removed; otherwise false.
Exceptions
RemoveAt Method
Removes the item at the specified index of the collection or view.
public void RemoveAt(int index)
Parameters
index int
The zero-based index of the item to remove.
Exceptions
Properties
| Name | Description |
|---|---|
| IsReadOnly | No summary available. |
| Item | No summary available. |
| Count | Gets the number of items in the collection. Inherited from ItemsSourceView. |
| Empty | Gets an empty Avalonia.Controls.ItemsSourceView Inherited from ItemsSourceView. |
| Source | Gets the source collection. Inherited from ItemsSourceView. |
IsReadOnly Property
public bool IsReadOnly { get; set; }
Item Property
public object Item { get; set; }
Events
| Name | Description |
|---|---|
| CollectionChanged | Occurs when the collection has changed to indicate the reason for the change and which items changed. Inherited from ItemsSourceView. |