Table of Contents

Class CollectionView

Namespace
Alternet.UI
Assembly
Alternet.UI.dll

ICollectionView with checks for affinity to the UI thread dispatcher

public class CollectionView : DispatcherObject, IBaseObject, IDisposableObject, IDisposable, ICollectionView, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged
Inheritance
CollectionView
Implements
Derived

Constructors

CollectionView(IEnumerable)

Create a view to given collection.

Properties

AllowsCrossThreadChanges

Returns true if this view supports CollectionChanged events raised by the source collection on a foreign thread (a thread different from the Dispatcher's thread).

CanFilter

Indicates whether or not this ICollectionView can do any filtering. When false, set Filter will throw an exception.

CanGroup

Returns true if this view really supports grouping. When this returns false, the rest of the interface is ignored.

CanSort

Test if this ICollectionView supports sorting before adding to SortDescriptions.

Comparer

Return an object that compares items in this view.

Count

Return the number of items (or -1, meaning "don't know"); if a Filter is set, this counts only items that pass the filter.

Culture

Culture to use during sorting.

CurrentItem

Return the "current item" for this view

CurrentPosition

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

Filter

Filter is a callback set by the consumer of the ICollectionView and used by the implementation of the ICollectionView to determine if an item is suitable for inclusion in the view.

GroupDescriptions

The description of grouping, indexed by level.

Groups

The top-level groups, constructed according to the descriptions given in GroupDescriptions.

IsCurrentAfterLast

Return true if CurrentItem is beyond the end (End-Of-File).

IsCurrentBeforeFirst

Return true if CurrentItem is before the beginning (Beginning-Of-File).

IsCurrentInSync

IsCurrentInSync returns true if CurrentItem and CurrentPosition are up-to-date with the state and content of the collection.

IsDynamic

returns true if the underlying collection provides change notifications the collection view is listening to the change events.

IsEmpty

Returns true if the resulting (filtered) view is emtpy.

IsInUse

Returns true if this view is in use (i.e. if anyone is listening to its events).

IsRefreshDeferred

IsRefreshDeferred returns true if there is still an outstanding DeferRefresh in use. If at all possible, derived classes should not call Refresh if IsRefreshDeferred is true.

NeedsRefresh

Returns true if this view needs to be refreshed.

NewItemPlaceholder

Gets the object that is in the collection to represent a new item.

SortDescriptions

Collection of Sort criteria to sort items in this view over the SourceCollection.

SourceCollection

Returns the underlying collection.

UpdatedOutsideDispatcher

Obsolete. Retained for compatibility. Use AllowsCrossThreadChanges instead.

Methods

ClearChangeLog()

Obsolete. Retained for compatibility. Use ClearPendingChanges instead.

ClearPendingChanges()

Clear any pending changes.

Contains(object)

Return true if the item belongs to this view. No assumptions are made about the item. This method will behave similarly to IList.Contains().

DeferRefresh()

Enter a Defer Cycle. Defer cycles are used to coalesce changes to the ICollectionView.

DetachFromSourceCollection()

Detach from the source collection. (I.e. stop listening to the collection's events, or anything else that makes the CollectionView ineligible for garbage collection.)

GetEnumerator()

Returns an object that enumerates the items in this view.

GetItemAt(int)

Retrieve item at the given zero-based index in this CollectionView.

IndexOf(object)

Return the index where the given item belongs, or -1 if this index is unknown.

MoveCurrentTo(object)

Move CurrentItem to the given item. If the item is not found, move to BeforeFirst.

MoveCurrentToFirst()

Move CurrentItem to the first item.

MoveCurrentToLast()

Move CurrentItem to the last item.

MoveCurrentToNext()

Move CurrentItem to the next item.

MoveCurrentToPosition(int)

Move CurrentItem to the item at the given index.

MoveCurrentToPrevious()

Move CurrentItem to the previous item.

OKToChangeCurrent()

ask listeners (via CurrentChanging event) if it's OK to change currency

OnAllowsCrossThreadChangesChanged()

This method is called when the value of AllowsCrossThreadChanges is changed. It gives a derived class an opportunity to initialize its support for cross-thread changes (or to retire that support).

OnBeginChangeLogging(NotifyCollectionChangedEventArgs)

Obsolete. Retained for compatibility. Use OnAllowsCrossThreadChangesChanged instead.

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Notify listeners that this View has changed

OnCollectionChanged(object, NotifyCollectionChangedEventArgs)

Handle CollectionChanged events.

Calls ProcessCollectionChanged() or posts the change to the Dispatcher to process on the correct thread.

OnCurrentChanged()

Raises the CurrentChanged event

OnCurrentChanging()

Raise a CurrentChanging event that is not cancelable. Internally, CurrentPosition is set to -1. This is called by CollectionChanges (Remove and Refresh) that affect the CurrentItem.

OnCurrentChanging(CurrentChangingEventArgs)

Raises the CurrentChanging event

OnPropertyChanged(PropertyChangedEventArgs)

Raises a PropertyChanged event (per INotifyPropertyChanged).

PassesFilter(object)

Return true if the item belongs to this view. The item is assumed to belong to the underlying DataCollection; this method merely takes filters into account. It is commonly used during collection-changed notifications to determine if the added/removed item requires processing. Returns true if no filter is set on collection view.

ProcessCollectionChanged(NotifyCollectionChangedEventArgs)

Must be implemented by the derived classes to process a single change on the UI thread. The UI thread will have already been entered by now.

ProcessPendingChanges()

Process all the pending changes

Refresh()

Re-create the view, using any SortDescriptions and/or Filter.

RefreshOrDefer()

Refresh, or mark that refresh is needed when defer cycle completes.

RefreshOverride()

Re-create the view, using any SortDescriptions and/or Filter.

SetCurrent(object, int)

set CurrentItem and CurrentPosition, no questions asked!

SetCurrent(object, int, int)

set CurrentItem and CurrentPosition, no questions asked!

Events

CollectionChanged

Raise this event when the (filtered) view changes

CurrentChanged

Raise this event after changing currency.

CurrentChanging

Raise this event before changing currency.

PropertyChanged

PropertyChanged event (per INotifyPropertyChanged).