Class ItemsSourceView
Represents a standardized view of the supported interactions between an items collection and an items control.
public class ItemsSourceView : IReadOnlyList<object?>, IReadOnlyCollection<object?>, IEnumerable<object?>, IList, ICollection, IEnumerable, INotifyCollectionChanged
- Inheritance
-
ItemsSourceView
- Implements
- Derived
- Inherited Members
Properties
Count
Gets the number of items in the collection.
public int Count { get; }
Property Value
Empty
Gets an empty ItemsSourceView
public static ItemsSourceView Empty { get; }
Property Value
this[int]
Retrieves the item at the specified index.
public object? this[int index] { get; }
Parameters
index
intThe index.
Property Value
- object
The item.
Source
Gets the source collection.
public IList Source { get; }
Property Value
Methods
Contains(object?)
public bool Contains(object? item)
Parameters
item
object
Returns
GetAt(int)
Retrieves the item at the specified index.
public object? GetAt(int index)
Parameters
index
intThe index.
Returns
- object
The item.
GetEnumerator()
public IEnumerator<object?> GetEnumerator()
Returns
GetOrCreate(IEnumerable?)
Gets or creates an ItemsSourceView for the specified enumerable.
public static ItemsSourceView GetOrCreate(IEnumerable? items)
Parameters
items
IEnumerableThe enumerable.
Returns
Remarks
This method handles the following three cases:
- If
items
is null, returns Empty - If
items
is an ItemsSourceView returns the existing ItemsSourceView - Otherwise creates a new ItemsSourceView
GetOrCreate<T>(IEnumerable<T>?)
Gets or creates an ItemsSourceView<T> for the specified enumerable.
public static ItemsSourceView<T> GetOrCreate<T>(IEnumerable<T>? items)
Parameters
items
IEnumerable<T>The enumerable.
Returns
Type Parameters
T
Remarks
This method handles the following three cases:
- If
items
is null, returns Empty - If
items
is an ItemsSourceView returns the existing ItemsSourceView - Otherwise creates a new ItemsSourceView
GetOrCreate<T>(IEnumerable?)
Gets or creates an ItemsSourceView<T> for the specified enumerable.
public static ItemsSourceView<T> GetOrCreate<T>(IEnumerable? items)
Parameters
items
IEnumerableThe enumerable.
Returns
Type Parameters
T
Remarks
This method handles the following three cases:
- If
items
is null, returns Empty - If
items
is an ItemsSourceView returns the existing ItemsSourceView - Otherwise creates a new ItemsSourceView
IndexOf(object?)
public int IndexOf(object? item)
Parameters
item
object
Returns
Events
CollectionChanged
Occurs when the collection has changed to indicate the reason for the change and which items changed.
public event NotifyCollectionChangedEventHandler? CollectionChanged