Partager via


ICollectionView Interface

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Enables collections to have the functionalities of current record management, custom sorting, filtering, and grouping.

Namespace:  System.ComponentModel
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Interface ICollectionView _
    Inherits IEnumerable, INotifyCollectionChanged
public interface ICollectionView : IEnumerable, 
    INotifyCollectionChanged

The ICollectionView type exposes the following members.

Properties

  Name Description
Public propertySupported by Silverlight for Windows Phone CanFilter Gets a value that indicates whether this view supports filtering by way of the Filter property.
Public propertySupported by Silverlight for Windows Phone CanGroup Gets a value that indicates whether this view supports grouping by way of the GroupDescriptions property.
Public propertySupported by Silverlight for Windows Phone CanSort Gets a value that indicates whether this view supports sorting by way of the SortDescriptions property.
Public propertySupported by Silverlight for Windows Phone Culture Gets or sets the cultural information for any operations of the view that may differ by culture, such as sorting.
Public propertySupported by Silverlight for Windows Phone CurrentItem Gets the current item in the view.
Public propertySupported by Silverlight for Windows Phone CurrentPosition Gets the ordinal position of the CurrentItem in the view.
Public propertySupported by Silverlight for Windows Phone Filter Gets or sets a callback that is used to determine whether an item is appropriate for inclusion in the view.
Public propertySupported by Silverlight for Windows Phone GroupDescriptions Gets a collection of GroupDescription objects that describe how the items in the collection are grouped in the view.
Public propertySupported by Silverlight for Windows Phone Groups Gets the top-level groups.
Public propertySupported by Silverlight for Windows Phone IsCurrentAfterLast Gets a value that indicates whether the CurrentItem of the view is beyond the end of the collection.
Public propertySupported by Silverlight for Windows Phone IsCurrentBeforeFirst Gets a value that indicates whether the CurrentItem of the view is beyond the start of the collection.
Public propertySupported by Silverlight for Windows Phone IsEmpty Gets a value that indicates whether the view is empty.
Public propertySupported by Silverlight for Windows Phone SortDescriptions Gets a collection of SortDescription instances that describe how the items in the collection are sorted in the view.
Public propertySupported by Silverlight for Windows Phone SourceCollection Gets the underlying collection.

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone Contains Indicates whether the specified item belongs to this collection view.
Public methodSupported by Silverlight for Windows Phone DeferRefresh Enters a defer cycle that you can use to merge changes to the view and delay automatic refresh.
Public methodSupported by Silverlight for Windows Phone GetEnumerator Returns an enumerator that iterates through a collection. (Inherited from IEnumerable.)
Public methodSupported by Silverlight for Windows Phone MoveCurrentTo Sets the specified item in the view as the CurrentItem.
Public methodSupported by Silverlight for Windows Phone MoveCurrentToFirst Sets the first item in the view as the CurrentItem.
Public methodSupported by Silverlight for Windows Phone MoveCurrentToLast Sets the last item in the view as the CurrentItem.
Public methodSupported by Silverlight for Windows Phone MoveCurrentToNext Sets the item after the CurrentItem in the view as the CurrentItem.
Public methodSupported by Silverlight for Windows Phone MoveCurrentToPosition Sets the item at the specified index to be the CurrentItem in the view.
Public methodSupported by Silverlight for Windows Phone MoveCurrentToPrevious Sets the item before the CurrentItem in the view to the CurrentItem.
Public methodSupported by Silverlight for Windows Phone Refresh Recreates the view.

Top

Events

  Name Description
Public eventSupported by Silverlight for Windows Phone CollectionChanged Occurs when the items list of the collection has changed, or the collection is reset. (Inherited from INotifyCollectionChanged.)
Public eventSupported by Silverlight for Windows Phone CurrentChanged Occurs after the current item has been changed.
Public eventSupported by Silverlight for Windows Phone CurrentChanging Occurs before the current item changes.

Top

Extension Methods

  Name Description
Public Extension MethodSupported by Silverlight for Windows Phone AsQueryable Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodSupported by Silverlight for Windows Phone Cast<TResult> Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodSupported by Silverlight for Windows Phone OfType<TResult> Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)

Top

Remarks

The DataGrid control uses this interface to access the indicated functionality in the data source assigned to its ItemsSource property. If the ItemsSource implements IList, but does not implement ICollectionView, the DataGrid wraps the ItemsSource in an internal ICollectionView implementation.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.