Share 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(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(4173041880, 57352, 23909, 140, 151, 123, 183, 144, 164, 35, 12)]
struct ICollectionView : IIterable<IInspectable>, IObservableVector<IInspectable>, IVector<IInspectable>
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.Guid(4173041880, 57352, 23909, 140, 151, 123, 183, 144, 164, 35, 12)]
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>

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, 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 IList and 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.

Applies to

See also