ListCollectionView ListCollectionView ListCollectionView ListCollectionView Class

Definition

Represents the collection view for collections that implement IList.

public ref class ListCollectionView : System::Windows::Data::CollectionView, System::Collections::IComparer, System::ComponentModel::ICollectionViewLiveShaping, System::ComponentModel::IEditableCollectionView, System::ComponentModel::IEditableCollectionViewAddNewItem, System::ComponentModel::IItemProperties
public class ListCollectionView : System.Windows.Data.CollectionView, System.Collections.IComparer, System.ComponentModel.ICollectionViewLiveShaping, System.ComponentModel.IEditableCollectionView, System.ComponentModel.IEditableCollectionViewAddNewItem, System.ComponentModel.IItemProperties
type ListCollectionView = class
    inherit CollectionView
    interface IComparer
    interface IEditableCollectionViewAddNewItem
    interface IEditableCollectionView
    interface ICollectionViewLiveShaping
    interface IItemProperties
Public Class ListCollectionView
Inherits CollectionView
Implements ICollectionViewLiveShaping, IComparer, IEditableCollectionView, IEditableCollectionViewAddNewItem, IItemProperties
Inheritance
Implements

Remarks

When you bind to a data collection, you may want to sort, filter, or group the data. To do that, you use collection views. You can think of a CollectionView as the layer on top of the binding source collection that allows you to navigate and display the source collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself. If the source collection implements the INotifyCollectionChanged interface, the changes raised by the CollectionChanged event are propagated to the views.

All collections have a default CollectionView. For all collections implementing IList, the ListCollectionView object is the default view object. The BindingListCollectionView is the collection view class used for collections that implement IBindingList. To get the default view, you use the GetDefaultView method. For an example, see How to: Get the Default View of a Data Collection.

For more information about collection views, see Data Binding Overview.

Constructors

ListCollectionView(IList) ListCollectionView(IList) ListCollectionView(IList) ListCollectionView(IList)

Initializes a new instance of the ListCollectionView class, using a supplied collection that implements IList.

Properties

ActiveComparer ActiveComparer ActiveComparer ActiveComparer

Gets or sets the current active comparer that is used in sorting.

ActiveFilter ActiveFilter ActiveFilter ActiveFilter

Gets or sets the current active Filter callback.

AllowsCrossThreadChanges AllowsCrossThreadChanges AllowsCrossThreadChanges AllowsCrossThreadChanges

Gets a value that indicates whether a thread other than the one that created the CollectionView can change the SourceCollection.

(Inherited from CollectionView)
CanAddNew CanAddNew CanAddNew CanAddNew

Gets a value that indicates whether a new item can be added to the collection.

CanAddNewItem CanAddNewItem CanAddNewItem CanAddNewItem

Gets a value that indicates whether a specified object can be added to the collection.

CanCancelEdit CanCancelEdit CanCancelEdit CanCancelEdit

Gets a value that indicates whether the collection view can discard pending changes and restore the original values of an edited object.

CanChangeLiveFiltering CanChangeLiveFiltering CanChangeLiveFiltering CanChangeLiveFiltering

Gets a value that indicates whether the collection view supports turning filtering data in real time on or off.

CanChangeLiveGrouping CanChangeLiveGrouping CanChangeLiveGrouping CanChangeLiveGrouping

Gets a value that indicates whether the collection view supports turning grouping data in real time on or off.

CanChangeLiveSorting CanChangeLiveSorting CanChangeLiveSorting CanChangeLiveSorting

Gets a value that indicates whether the collection view supports turning sorting data in real time on or off.

CanFilter CanFilter CanFilter CanFilter

Gets a value that indicates whether the view supports callback-based filtering.

CanGroup CanGroup CanGroup CanGroup

Gets a value that indicates whether the collection view supports grouping.

CanRemove CanRemove CanRemove CanRemove

Gets a value that indicates whether an item can be removed from the collection.

CanSort CanSort CanSort CanSort

Gets a value that indicates whether the collection view supports sorting.

Comparer Comparer Comparer Comparer

Returns an object that you can use to compare items in the view.

(Inherited from CollectionView)
Count Count Count Count

Gets the estimated number of records.

Culture Culture Culture Culture

Gets or sets the culture information to use during sorting.

(Inherited from CollectionView)
CurrentAddItem CurrentAddItem CurrentAddItem CurrentAddItem

Gets the item that is being added during the current add transaction.

CurrentEditItem CurrentEditItem CurrentEditItem CurrentEditItem

Gets the item in the collection that is being edited.

CurrentItem CurrentItem CurrentItem CurrentItem

Gets the current item in the view.

(Inherited from CollectionView)
CurrentPosition CurrentPosition CurrentPosition CurrentPosition

Gets the ordinal position of the CurrentItem within the (optionally sorted and filtered) view.

(Inherited from CollectionView)
CustomSort CustomSort CustomSort CustomSort

Gets or sets a custom object that implements IComparer to sort items in the view.

Dispatcher Dispatcher Dispatcher Dispatcher

Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
Filter Filter Filter Filter

Gets or sets a method that is used to determine whether an item is suitable for inclusion in the view.

GroupBySelector GroupBySelector GroupBySelector GroupBySelector

Gets or sets a delegate to select the GroupDescription as a function of the parent group and its level.

GroupDescriptions GroupDescriptions GroupDescriptions GroupDescriptions

Gets a collection of GroupDescription objects that describe how the items in the collection are grouped in the view.

Groups Groups Groups Groups

Gets the top-level groups.

InternalCount InternalCount InternalCount InternalCount

Gets the number of records in the InternalList.

InternalList InternalList InternalList InternalList

Gets the complete and unfiltered underlying collection.

IsAddingNew IsAddingNew IsAddingNew IsAddingNew

Gets a value that indicates whether an add transaction is in progress.

IsCurrentAfterLast IsCurrentAfterLast IsCurrentAfterLast IsCurrentAfterLast

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

(Inherited from CollectionView)
IsCurrentBeforeFirst IsCurrentBeforeFirst IsCurrentBeforeFirst IsCurrentBeforeFirst

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

(Inherited from CollectionView)
IsCurrentInSync IsCurrentInSync IsCurrentInSync IsCurrentInSync

Gets a value that indicates whether the CurrentItem is at the CurrentPosition.

(Inherited from CollectionView)
IsDataInGroupOrder IsDataInGroupOrder IsDataInGroupOrder IsDataInGroupOrder

Gets or sets a value that indicates whether the list of items (after applying the sort and filters, if any) is already in the correct order for grouping.

IsDynamic IsDynamic IsDynamic IsDynamic

Gets a value that indicates whether the underlying collection provides change notifications.

(Inherited from CollectionView)
IsEditingItem IsEditingItem IsEditingItem IsEditingItem

Gets a value that indicates whether an edit transaction is in progress.

IsEmpty IsEmpty IsEmpty IsEmpty

Returns a value that indicates whether the resulting (filtered) view is empty.

IsGrouping IsGrouping IsGrouping IsGrouping

Gets a value that indicates whether there are groups in the view.

IsInUse IsInUse IsInUse IsInUse

Gets a value that indicates whether any object is subscribing to the events of this CollectionView.

(Inherited from CollectionView)
IsLiveFiltering IsLiveFiltering IsLiveFiltering IsLiveFiltering

Gets or sets a value that indicates whether filtering data in real time is enabled.

IsLiveGrouping IsLiveGrouping IsLiveGrouping IsLiveGrouping

Gets or sets a value that indicates whether grouping data in real time is enabled.

IsLiveSorting IsLiveSorting IsLiveSorting IsLiveSorting

Gets or sets a value that indicates whether sorting in real time is enabled.

IsRefreshDeferred IsRefreshDeferred IsRefreshDeferred IsRefreshDeferred

Gets a value that indicates whether there is an outstanding DeferRefresh() in use.

(Inherited from CollectionView)
ItemProperties ItemProperties ItemProperties ItemProperties

Gets a collection of objects that describes the properties of the items in the collection.

LiveFilteringProperties LiveFilteringProperties LiveFilteringProperties LiveFilteringProperties

Gets a collection of strings that specify the properties that participate in filtering data in real time.

LiveGroupingProperties LiveGroupingProperties LiveGroupingProperties LiveGroupingProperties

Gets a collection of strings that specify the properties that participate in grouping data in real time.

LiveSortingProperties LiveSortingProperties LiveSortingProperties LiveSortingProperties

Gets a collection of strings that specify the properties that participate in sorting data in real time.

NeedsRefresh NeedsRefresh NeedsRefresh NeedsRefresh

Gets a value that indicates whether the view needs to be refreshed.

(Inherited from CollectionView)
NewItemPlaceholderPosition NewItemPlaceholderPosition NewItemPlaceholderPosition NewItemPlaceholderPosition

Gets or sets the position of the new item placeholder in the ListCollectionView.

SortDescriptions SortDescriptions SortDescriptions SortDescriptions

Gets a collection of SortDescription objects that describes how the items in the collection are sorted in the view.

SourceCollection SourceCollection SourceCollection SourceCollection

Returns the underlying unfiltered collection.

(Inherited from CollectionView)
UpdatedOutsideDispatcher UpdatedOutsideDispatcher UpdatedOutsideDispatcher UpdatedOutsideDispatcher

Gets a value that indicates whether it has been necessary to update the change log because a CollectionChanged notification has been received on a different thread without first entering the user interface (UI) thread dispatcher.

(Inherited from CollectionView)
UsesLocalArray UsesLocalArray UsesLocalArray UsesLocalArray

Gets a value that indicates whether a private copy of the data is needed for sorting and filtering.

Methods

AddNew() AddNew() AddNew() AddNew()

Starts an add transaction and returns the pending new item.

AddNewItem(Object) AddNewItem(Object) AddNewItem(Object) AddNewItem(Object)

Adds the specified object to the collection.

CancelEdit() CancelEdit() CancelEdit() CancelEdit()

Ends the edit transaction, and if possible, restores the original value to the item.

CancelNew() CancelNew() CancelNew() CancelNew()

Ends the add transaction and discards the pending new item.

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

Determines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearChangeLog() ClearChangeLog() ClearChangeLog() ClearChangeLog()

Clears any pending changes from the change log.

(Inherited from CollectionView)
ClearPendingChanges() ClearPendingChanges() ClearPendingChanges() ClearPendingChanges()

Clears unprocessed changed to the collection.

(Inherited from CollectionView)
CommitEdit() CommitEdit() CommitEdit() CommitEdit()

Ends the edit transaction and saves the pending changes.

CommitNew() CommitNew() CommitNew() CommitNew()

Ends the add transaction and saves the pending new item.

Compare(Object, Object) Compare(Object, Object) Compare(Object, Object) Compare(Object, Object)

Compares two objects and returns a value that indicates whether one is less than, equal to, or greater than the other.

Contains(Object) Contains(Object) Contains(Object) Contains(Object)

Returns a value that indicates whether a given item belongs to the collection view.

DeferRefresh() DeferRefresh() DeferRefresh() DeferRefresh()

Enters a defer cycle that you can use to merge changes to the view and delay automatic refresh.

(Inherited from CollectionView)
DetachFromSourceCollection() DetachFromSourceCollection() DetachFromSourceCollection() DetachFromSourceCollection()

Removes the reference to the underlying collection from the CollectionView.

(Inherited from CollectionView)
EditItem(Object) EditItem(Object) EditItem(Object) EditItem(Object)

Begins an edit transaction of the specified item.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an object that you can use to enumerate the items in the view.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetItemAt(Int32) GetItemAt(Int32) GetItemAt(Int32) GetItemAt(Int32)

Retrieves the item at the specified position in the view.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexOf(Object) IndexOf(Object) IndexOf(Object) IndexOf(Object)

Returns the index where the given data item belongs in the collection, or -1 if the index of that item is unknown.

InternalContains(Object) InternalContains(Object) InternalContains(Object) InternalContains(Object)

Return a value that indicates whether the InternalList contains the item.

InternalGetEnumerator() InternalGetEnumerator() InternalGetEnumerator() InternalGetEnumerator()

Returns an enumerator for the InternalList.

InternalIndexOf(Object) InternalIndexOf(Object) InternalIndexOf(Object) InternalIndexOf(Object)

Returns the index of the specified item in the InternalList.

InternalItemAt(Int32) InternalItemAt(Int32) InternalItemAt(Int32) InternalItemAt(Int32)

Returns the item at the given index in the InternalList.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MoveCurrentTo(Object) MoveCurrentTo(Object) MoveCurrentTo(Object) MoveCurrentTo(Object)

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

(Inherited from CollectionView)
MoveCurrentToFirst() MoveCurrentToFirst() MoveCurrentToFirst() MoveCurrentToFirst()

Sets the first item in the view as the CurrentItem.

(Inherited from CollectionView)
MoveCurrentToLast() MoveCurrentToLast() MoveCurrentToLast() MoveCurrentToLast()

Sets the last item in the view as the CurrentItem.

(Inherited from CollectionView)
MoveCurrentToNext() MoveCurrentToNext() MoveCurrentToNext() MoveCurrentToNext()

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

(Inherited from CollectionView)
MoveCurrentToPosition(Int32) MoveCurrentToPosition(Int32) MoveCurrentToPosition(Int32) MoveCurrentToPosition(Int32)

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

MoveCurrentToPrevious() MoveCurrentToPrevious() MoveCurrentToPrevious() MoveCurrentToPrevious()

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

(Inherited from CollectionView)
OKToChangeCurrent() OKToChangeCurrent() OKToChangeCurrent() OKToChangeCurrent()

Returns a value that indicates whether the view can change which item is the CurrentItem.

(Inherited from CollectionView)
OnAllowsCrossThreadChangesChanged() OnAllowsCrossThreadChangesChanged() OnAllowsCrossThreadChangesChanged() OnAllowsCrossThreadChangesChanged()

Occurs when the AllowsCrossThreadChanges property changes.

OnBeginChangeLogging(NotifyCollectionChangedEventArgs) OnBeginChangeLogging(NotifyCollectionChangedEventArgs) OnBeginChangeLogging(NotifyCollectionChangedEventArgs) OnBeginChangeLogging(NotifyCollectionChangedEventArgs)

Called by the base class to notify the derived class that a CollectionChanged event has been posted to the message queue.

OnCollectionChanged(NotifyCollectionChangedEventArgs) OnCollectionChanged(NotifyCollectionChangedEventArgs) OnCollectionChanged(NotifyCollectionChangedEventArgs) OnCollectionChanged(NotifyCollectionChangedEventArgs)

Raises the CollectionChanged event.

(Inherited from CollectionView)
OnCollectionChanged(Object, NotifyCollectionChangedEventArgs) OnCollectionChanged(Object, NotifyCollectionChangedEventArgs) OnCollectionChanged(Object, NotifyCollectionChangedEventArgs) OnCollectionChanged(Object, NotifyCollectionChangedEventArgs)

Raises the CollectionChanged event.

(Inherited from CollectionView)
OnCurrentChanged() OnCurrentChanged() OnCurrentChanged() OnCurrentChanged()

Raises the CurrentChanged event.

(Inherited from CollectionView)
OnCurrentChanging() OnCurrentChanging() OnCurrentChanging() OnCurrentChanging()

Raises a CurrentChanging event that is not cancelable.

(Inherited from CollectionView)
OnCurrentChanging(CurrentChangingEventArgs) OnCurrentChanging(CurrentChangingEventArgs) OnCurrentChanging(CurrentChangingEventArgs) OnCurrentChanging(CurrentChangingEventArgs)

Raises the CurrentChanging event with the specified arguments.

(Inherited from CollectionView)
OnPropertyChanged(PropertyChangedEventArgs) OnPropertyChanged(PropertyChangedEventArgs) OnPropertyChanged(PropertyChangedEventArgs) OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event using the specified arguments.

(Inherited from CollectionView)
PassesFilter(Object) PassesFilter(Object) PassesFilter(Object) PassesFilter(Object)

Returns a value that indicates whether the specified item in the underlying collection belongs to the view.

ProcessCollectionChanged(NotifyCollectionChangedEventArgs) ProcessCollectionChanged(NotifyCollectionChangedEventArgs) ProcessCollectionChanged(NotifyCollectionChangedEventArgs) ProcessCollectionChanged(NotifyCollectionChangedEventArgs)

Handles CollectionChanged events.

ProcessPendingChanges() ProcessPendingChanges() ProcessPendingChanges() ProcessPendingChanges()

Ensures that all pending changes to the collection have been committed.

(Inherited from CollectionView)
Refresh() Refresh() Refresh() Refresh()

Re-creates the view.

(Inherited from CollectionView)
RefreshOrDefer() RefreshOrDefer() RefreshOrDefer() RefreshOrDefer()

Refreshes the view or specifies that the view needs to be refreshed when the defer cycle completes.

(Inherited from CollectionView)
RefreshOverride() RefreshOverride() RefreshOverride() RefreshOverride()

Recreates the view.

Remove(Object) Remove(Object) Remove(Object) Remove(Object)

Removes the specified item from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes the item at the specified position from the collection.

SetCurrent(Object, Int32) SetCurrent(Object, Int32) SetCurrent(Object, Int32) SetCurrent(Object, Int32)

Sets the specified item and index as the values of the CurrentItem and CurrentPosition properties.

(Inherited from CollectionView)
SetCurrent(Object, Int32, Int32) SetCurrent(Object, Int32, Int32) SetCurrent(Object, Int32, Int32) SetCurrent(Object, Int32, Int32)

Sets the specified item and index as the values of the CurrentItem and CurrentPosition properties. This method can be called from a constructor of a derived class.

(Inherited from CollectionView)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

Explicit Interface Implementations

IComparer.Compare(Object, Object) IComparer.Compare(Object, Object) IComparer.Compare(Object, Object) IComparer.Compare(Object, Object)

This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an IEnumerator object that you can use to enumerate the items in the view.

(Inherited from CollectionView)

Events

CollectionChanged CollectionChanged CollectionChanged CollectionChanged

Occurs when the view has changed.

(Inherited from CollectionView)
CurrentChanged CurrentChanged CurrentChanged CurrentChanged

Occurs after the CurrentItem has changed.

(Inherited from CollectionView)
CurrentChanging CurrentChanging CurrentChanging CurrentChanging

Occurs when the CurrentItem is changing.

(Inherited from CollectionView)
INotifyCollectionChanged.CollectionChanged INotifyCollectionChanged.CollectionChanged INotifyCollectionChanged.CollectionChanged INotifyCollectionChanged.CollectionChanged Inherited from CollectionView
INotifyPropertyChanged.PropertyChanged INotifyPropertyChanged.PropertyChanged INotifyPropertyChanged.PropertyChanged INotifyPropertyChanged.PropertyChanged Inherited from CollectionView
PropertyChanged PropertyChanged PropertyChanged PropertyChanged

Occurs when a property value has changed.

(Inherited from CollectionView)

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to