ICollectionView interface

Applies to Windows and Windows Phone

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

Syntax

Public Interface ICollectionView 
    Inherits IObservableVector(Of Object), IList(Of Object), IEnumerable(Of Object)

Attributes

[Version(0x06020000)]
[WebHostHidden()]

Members

The ICollectionView interface has these types of members:

Events

The ICollectionView interface has these events.

EventDescription
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.

 

Methods

The ICollectionView interface has these methods. It also inherits methods from the Object class.

MethodDescription
LoadMoreItemsAsync Initializes incremental loading from the view.
MoveCurrentTo 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 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.

 

Properties

The ICollectionView interface has these properties.

PropertyAccess typeDescription

CollectionGroups

Read-onlyReturns any collection groups that are associated with the view.

CurrentItem

Read-onlyGets the current item in the view.

CurrentPosition

Read-onlyGets the ordinal position of the CurrentItem within the view.

HasMoreItems

Read-onlyGets a sentinel value that supports incremental loading implementations. See also LoadMoreItemsAsync.

IsCurrentAfterLast

Read-onlyGets a value that indicates whether the CurrentItem of the view is beyond the end of the collection.

IsCurrentBeforeFirst

Read-onlyGets a value that indicates whether the CurrentItem of the view is beyond the beginning of the collection.

 

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 IList and IEnumerable for Microsoft .NET usage.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Data
Windows::UI::Xaml::Data [C++]

Metadata

Windows.winmd

See also

IObservableVector<T>
IVector<T>
IIterable<T>
CollectionViewSource
Binding
XAML data binding sample
Data binding overview

 

 

Show:
© 2014 Microsoft