Delen via


ICollectionView Interface

Definition

Enables collections to support current record management, grouping, and incremental loading (data virtualization).

public interface class ICollectionView : IIterable<Platform::Object ^>, IObservableVector<Platform::Object ^>, IVector<Platform::Object ^>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(2347286500, 56303, 17631, 129, 38, 163, 26, 137, 18, 29, 220)]
struct ICollectionView : IIterable<IInspectable>, IObservableVector<IInspectable>, IVector<IInspectable>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(2347286500, 56303, 17631, 129, 38, 163, 26, 137, 18, 29, 220)]
public interface ICollectionView : IEnumerable<object>, IList<object>, IObservableVector<object>
Public Interface ICollectionView
Implements IEnumerable(Of Object), IList(Of Object), IObservableVector(Of Object)
Attributes
Implements
IEnumerable<Object> IIterable<Platform::Object> IIterable<IInspectable> IIterable<T> IEnumerable<T> IList<Object> IVector<Platform::Object> IVector<IInspectable> IVector<T> IList<T> IObservableVector<Object> IObservableVector<Platform::Object> IObservableVector<IInspectable>

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

ICollectionView is an interface used to represent a collection. It serves to maintain currency for properties like item selection.

To implement custom behavior for selection currency in your data source, your data source should implement ICollectionViewFactory instead of implementing ICollectionView directly. You can set the CollectionViewSource.Source property to an ICollectionViewFactory, but if you set it to an ICollectionView, it will throw an exception.

The CollectionGroups property is of type IObservableVector<object>, but these objects should implement ICollectionViewGroup.

Interface inheritance

ICollectionView inherits IObservableVector, IVector and IIterable . Types that implement ICollectionView also implement the interface members of IObservableVector, and either IVector and IIterable for C++ usage or IListand IEnumerable for Microsoft .NET usage.

Properties

CollectionGroups

Returns any collection groups that are associated with the view.

CurrentItem

Gets the current item in the view.

CurrentPosition

Gets the ordinal position of the CurrentItem within the view.

HasMoreItems

Gets a sentinel value that supports incremental loading implementations. See also LoadMoreItemsAsync.

IsCurrentAfterLast

Gets a value that indicates whether the CurrentItem of the view is beyond the end of the collection.

IsCurrentBeforeFirst

Gets a value that indicates whether the CurrentItem of the view is beyond the beginning of the collection.

Methods

LoadMoreItemsAsync(UInt32)

Initializes incremental loading from the view.

MoveCurrentTo(Object)

Sets the specified item to be the CurrentItem in the view.

MoveCurrentToFirst()

Sets the first item in the view as the CurrentItem.

MoveCurrentToLast()

Sets the last item in the view as the CurrentItem.

MoveCurrentToNext()

Sets the item after the CurrentItem in the view as the CurrentItem.

MoveCurrentToPosition(Int32)

Sets the item at the specified index to be the CurrentItem in the view.

MoveCurrentToPrevious()

Sets the item before the CurrentItem in the view as the CurrentItem.

Events

CurrentChanged

When implementing this interface, fire this event after the current item has been changed.

CurrentChanging

When implementing this interface, fire this event before changing the current item. The event handler can cancel this event.

VectorChanged

Occurs when the vector changes.

(Inherited from IObservableVector<T>)

Applies to

See also