Color legend plain property method event
A list that raises OnCollectionChanged for every change, so a bound ListBox, ComboBox, TreeView or ContextMenu updates only the changed rows. It implements IBindableCollection and IReadOnlyList<T>, and can be filled with a collection initializer or [].
A class. The styles page shows it in context.
Names are colored by what they are: a property, a method or an event; values and fields keep the plain color.
Properties
Count 馃爢
int 路 Read-only. The number of items.
IsReadOnly 馃爢
bool 路 Read-only. Always false.
Item 馃爢
T 路 The item at the index. Setting it is reported as the old item removed and the new one added at that index.
Methods
BindableCollection() 馃爢
BindableCollection() 路 Creates an empty collection.
Add() 馃爢
Add(T item) 路 Adds the item at the end.
| Parameter | Type | Description |
|---|---|---|
item |
T |
The item to add. |
AddRange() 馃爢
AddRange(IEnumerable<T> collection) 路 Adds the items at the end, reported as one change. Does nothing for null or an empty collection.
| Parameter | Type | Description |
|---|---|---|
collection |
IEnumerable<T> |
The items to add, in order. |
Clear() 馃爢
Clear() 路 Removes every item, reported as one change.
Contains() 馃爢
Contains(T item) 路 Whether the item is in the collection.
| Parameter | Type | Description |
|---|---|---|
item |
T |
The item to look for. |
CopyTo() 馃爢
CopyTo(T[] array, int arrayIndex) 路 Copies the items into the array from the index.
| Parameter | Type | Description |
|---|---|---|
array |
T[] |
The array to copy the items into. |
arrayIndex |
int |
The index in the array where the first item goes. |
GetEnumerator() 馃爢
GetEnumerator() 路 Enumerates the items.
Insert() 馃爢
Insert(int index, T item) 路 Inserts the item at the index. An index outside 0..Count is ignored.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The position to insert at, from 0 to Count. |
item |
T |
The item to insert. |
InsertRange() 馃爢
InsertRange(int index, IEnumerable<T> collection) 路 Inserts the items at the index, reported as one change. An index outside 0..Count is ignored.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The position to insert at, from 0 to Count. |
collection |
IEnumerable<T> |
The items to insert, in order. |
Remove() 馃爢
Remove(T item) 路 Removes the first occurrence of the item. Returns false when it is not in the collection.
| Parameter | Type | Description |
|---|---|---|
item |
T |
The item to remove. |
RemoveAt() 馃爢
RemoveAt(int index) 路 Removes the item at the index. An index out of range is ignored.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The index of the item to remove. |
RemoveRange() 馃爢
RemoveRange(int index, int count) 路 Removes up to count items from the index, reported as one change.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The index of the first item to remove. |
count |
int |
The number of items to remove. |
TryGetElementAt() 馃爢
TryGetElementAt(int index) 路 Returns the item at the index, or default when the index is out of range.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The index of the item. |
Events
OnCollectionChanged 馃爢
(bool isItemsAdded, int startIndex, int count) 路 Items are added (isItemsAdded is true) or removed, starting at startIndex.
| Parameter | Type | Description |
|---|---|---|
isItemsAdded |
bool |
true when items were added, false when they were removed. |
startIndex |
int |
The index of the first item added or removed. |
count |
int |
The number of items added or removed. |