ComponentOne Grid for WPF: Using Grid for WPF > Using the C1CollectionView Class

Using the C1CollectionView Class

The C1CollectionView class was added to ComponentOne Grid for WPF in the 2010 v1 release. This class can be used as a replacement for native CollectionView, ListCollectionView and BindingListCollectionView classes and provides performance gains for grouping and sorting operations.

Performance Benefits

Using the C1CollectionView class rather than the CollectionView, ListCollectionView and BindingListCollectionView classes can provide the following performance benefits:

      Improved Local Sorting

Local sorting performed by the view (this is analogous of sorting operations performed by the Microsoft ListCollectionView) completes 5 times faster.

      Improved Grouping

Grouping completes up to ten times as fast as Microsoft's ListCollectionView or BindingListCollectionView. Particularly when in a performance-intensive scenario, such as if there is one group per item and a huge number of groups, C1CollectionView improves performance significantly.

Functional Benefits

There are also some functional benefits regarding these operations in C1CollectionView.

As you may know there are three different types of possible data sources: IEnumerable (no indexed access to items), IList (with indexed access to items) and IBindingList/IBindingListView (IList with filtering and sorting capabilities, the main implementer of which is the ADO.NET DataTable). Microsoft has separate view class for each of the  mentioned types of source: CollectionView, ListCollectionView and BindingListCollectionView, respectively. Sorting and filtering operations can be potentially implemented by the view (local sort/filtering) or by data source (in case of IBindingList).

C1CollectionView gathers all this functionality in a single class (three-in-one), it accepts any IEnumerable, recognizes more specific interfaces supported by the source (IList or IBindingList/IBindingListView) and utilizes the additional capabilities offered by these interfaces. The table below summarizes the data processing capabilities provided by Micosoft and ComponentOne views:

 

 

CollectionView

(IEnumerable)

ListCollectionView

(IList)

BindingListCollectionView

(IBindingList/ IBindingListView)

C1CollectionView

(any IEnumerable)

Grouping

-

+

+

+

Local Sorting

-

+

-

+

Local Filtering

+

+

-

+

Source Sorting

not applicable

not applicable

+

+ for IBindingList

Source Filtering

not applicable

not applicable

+

+ for IBindingListView

 

As you see, C1CollectionView supports sorting and grouping operations for "just IEnumerable" (non-IList), which is not provided by MS CollectionView, and supports local sorting and filtering (in addition to data source sorting/filtering) for IBindingList/IBindingListView, as opposite to BindingListCollectionView that supports a processing by data source only.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.