New to Telerik UI for WinForms? Start a free 30-day trial

Provides a concrete collection view with indexed filtering, sorting, grouping, and optional paging for IDataItem collections.

Definition

Namespace:Telerik.WinControls.Data

Assembly:Telerik.WinControls.dll

Type Parameters:

TDataItem

The data-item type exposed by the view.

Syntax:

C#
public class RadDataView<TDataItem> : RadCollectionView<TDataItem>, ICollectionView<TDataItem>, IPagedCollectionView, IReadOnlyCollection<TDataItem>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged where TDataItem : IDataItem

Inheritance: objectRadCollectionView<TDataItem>RadDataView<TDataItem>

Derived Classes: GridDataViewTemplateDataView

Implements: ICollectionView<TDataItem>IEnumerableINotifyCollectionChangedINotifyPropertyChangedIPagedCollectionViewIReadOnlyCollection<TDataItem>...

Inherited Members RadCollectionView<TDataItem>.PassesFilter(TDataItem)RadCollectionView<TDataItem>.BeginUpdate()RadCollectionView<TDataItem>.EndUpdate(bool)RadCollectionView<TDataItem>.EndUpdate()RadCollectionView<TDataItem>.DeferRefresh()RadCollectionView<TDataItem>.CopyTo(TDataItem[], int)RadCollectionView<TDataItem>.LoadData(IEnumerable<TDataItem>)RadCollectionView<TDataItem>.FindGroup(Group<TDataItem>)RadCollectionView<TDataItem>.ContainsGroup(Group<TDataItem>)RadCollectionView<TDataItem>.Contains(TDataItem)RadCollectionView<TDataItem>.FilterEvaluate(FilterDescriptor, TDataItem)RadCollectionView<TDataItem>.Evaluate(string, TDataItem)RadCollectionView<TDataItem>.Evaluate(string, int, int)RadCollectionView<TDataItem>.Evaluate(string, IEnumerable<TDataItem>)RadCollectionView<TDataItem>.ClearThreadedFilterNodes()RadCollectionView<TDataItem>.GetFieldValue(TDataItem, string)RadCollectionView<TDataItem>.InitializeSource(IEnumerable<TDataItem>)RadCollectionView<TDataItem>.OnCurrentChanged(EventArgs)RadCollectionView<TDataItem>.OnCurrentChanging(CancelEventArgs)RadCollectionView<TDataItem>.MoveCurrentTo(TDataItem)RadCollectionView<TDataItem>.MoveCurrentToFirst()RadCollectionView<TDataItem>.MoveCurrentToLast()RadCollectionView<TDataItem>.MoveCurrentToNext()RadCollectionView<TDataItem>.MoveCurrentToPosition(int)RadCollectionView<TDataItem>.SetCurrentPositionCore(int, bool)RadCollectionView<TDataItem>.SetCurrentPositionCore(int, bool, CurrentChangeReason)RadCollectionView<TDataItem>.MoveCurrentToPrevious()RadCollectionView<TDataItem>.Refresh()RadCollectionView<TDataItem>.OnCollectionChanged(NotifyCollectionChangedEventArgs)RadCollectionView<TDataItem>.VersionUpdateNeeded(NotifyCollectionChangedEventArgs)RadCollectionView<TDataItem>.EnsurePageIndex()RadCollectionView<TDataItem>.GetEnumerator()RadCollectionView<TDataItem>.MoveToFirstPage()RadCollectionView<TDataItem>.MoveToNextPage()RadCollectionView<TDataItem>.MoveToPage(int)RadCollectionView<TDataItem>.MoveToPreviousPage()RadCollectionView<TDataItem>.OnPageChanging(int)RadCollectionView<TDataItem>.OnPageChanged()RadCollectionView<TDataItem>.ChangeCurrentOnAddRadCollectionView<TDataItem>.IsEmptyRadCollectionView<TDataItem>.IsDynamicRadCollectionView<TDataItem>.CountRadCollectionView<TDataItem>.this[int]RadCollectionView<TDataItem>.CaseSensitiveRadCollectionView<TDataItem>.FilterExpressionRadCollectionView<TDataItem>.BypassFilterRadCollectionView<TDataItem>.BypassSortRadCollectionView<TDataItem>.HasFilterRadCollectionView<TDataItem>.IsInUpdateRadCollectionView<TDataItem>.HasDataOperationRadCollectionView<TDataItem>.GroupFactoryRadCollectionView<TDataItem>.HasGroupRadCollectionView<TDataItem>.SortDescriptorCollectionFactoryRadCollectionView<TDataItem>.GroupDescriptorCollectionFactoryRadCollectionView<TDataItem>.HasSortRadCollectionView<TDataItem>.CurrentItemRadCollectionView<TDataItem>.CurrentPositionRadCollectionView<TDataItem>.SourceCollectionRadCollectionView<TDataItem>.SortDescriptorsRadCollectionView<TDataItem>.GroupDescriptorsRadCollectionView<TDataItem>.FilterRadCollectionView<TDataItem>.IsIncrementalFilteringRadCollectionView<TDataItem>.DefaultFilterRadCollectionView<TDataItem>.PagingBeforeGroupingRadCollectionView<TDataItem>.CanChangePageRadCollectionView<TDataItem>.IsPageChangingRadCollectionView<TDataItem>.PageIndexRadCollectionView<TDataItem>.PageSizeRadCollectionView<TDataItem>.CurrentChangedRadCollectionView<TDataItem>.CurrentChangingRadCollectionView<TDataItem>.CollectionChangedRadCollectionView<TDataItem>.PropertyChangedRadCollectionView<TDataItem>.PageChangedRadCollectionView<TDataItem>.PageChanging...

Constructors

Initializes the view over a data-item sequence and creates its index and group builder.

C#
public RadDataView(IEnumerable<TDataItem> collection)
Parameters:collectionIEnumerable<TDataItem>

The sequence to expose through the view.

Properties

Gets or sets a value indicating whether this data view can filter.

C#
public override bool CanFilter { get; set; }
Property Value:

true if this instance can filter; otherwise, false.

Overrides: RadCollectionView<TDataItem>.CanFilter

Gets or sets a value indicating whether this data view can group.

C#
public override bool CanGroup { get; set; }
Property Value:

true if this instance can group; otherwise, false.

Overrides: RadCollectionView<TDataItem>.CanGroup

Gets or sets a value indicating whether this data view can be paginated.

C#
public override bool CanPage { get; set; }
Property Value:

true if this data view can be paginated; otherwise, false.

Overrides: RadCollectionView<TDataItem>.CanPage

Gets or sets a value indicating whether this data view can sort.

C#
public override bool CanSort { get; set; }
Property Value:

true if this instance can sort; otherwise, false.

Overrides: RadCollectionView<TDataItem>.CanSort

Comparer

IComparer<TDataItem>

Gets or sets the sort comparer.

C#
public override IComparer<TDataItem> Comparer { get; set; }
Property Value:

The comparer.

Overrides: RadCollectionView<TDataItem>.Comparer

Gets the default group predicate.

C#
public override GroupPredicate<TDataItem> DefaultGroupPredicate { get; }
Property Value:

The default group predicate.

Overrides: RadCollectionView<TDataItem>.DefaultGroupPredicate

Gets the builder that materializes groups from this view's index and descriptors.

C#
public GroupBuilder<TDataItem> GroupBuilder { get; }

GroupComparer

IComparer<Group<TDataItem>>

Gets or sets the group comparer.

C#
public override IComparer<Group<TDataItem>> GroupComparer { get; set; }
Property Value:

The group comparer.

Overrides: RadCollectionView<TDataItem>.GroupComparer

Gets or sets the group predicate.

C#
public override GroupPredicate<TDataItem> GroupPredicate { get; set; }
Property Value:

The group predicate.

Overrides: RadCollectionView<TDataItem>.GroupPredicate

Gets the groups.

C#
public override GroupCollection<TDataItem> Groups { get; }
Property Value:

The groups.

Overrides: RadCollectionView<TDataItem>.Groups

Indexer

Index<TDataItem>

Gets the index that supplies the view's filtered and sorted items.

C#
public Index<TDataItem> Indexer { get; }

Gets the number of items in the index, independent of the currently exposed page.

C#
public override int ItemCount { get; }

Overrides: RadCollectionView<TDataItem>.ItemCount

Items

IList<TDataItem>

Gets the current indexed items, applying item-level paging when compatible with the grouping order.

C#
protected override IList<TDataItem> Items { get; }

Overrides: RadCollectionView<TDataItem>.Items

When paging follows grouping, the full item index remains available so the group builder can page groups instead.

Gets the number of pages of items or top-level groups, according to the paging order.

C#
public override int TotalPages { get; }

Overrides: RadCollectionView<TDataItem>.TotalPages

When grouping is active and paging follows grouping, pages are counted from the top-level groups; otherwise the base view's item-page count is used.

Gets or sets whether the view uses a hybrid list/tree index instead of an AVL index.

C#
public bool UseHybridIndex { get; set; }

The default is true. Changing the setting recreates the index and group builder.

Methods

Creates a group builder over the current item index.

C#
protected virtual GroupBuilder<TDataItem> CreateGroupBuilder()
Returns:

GroupBuilder<TDataItem>

A builder that generates the hierarchy exposed by Groups.

Creates the index implementation selected by UseHybridIndex.

C#
protected virtual Index<TDataItem> CreateIndex()
Returns:

Index<TDataItem>

A HybridIndex<T> or AvlIndex<T> for this view.

Resolves the field indexes used by the current sort and group descriptors.

C#
public override void EnsureDescriptors()

Overrides: RadCollectionView<TDataItem>.EnsureDescriptors()

Finds a data item by its view index or associated bound object when no data operation is active.

C#
public override TDataItem Find(int itemIndex, object dataBoundItem)
Parameters:itemIndexint

The candidate index in the view.

dataBoundItemobject

The underlying object to match against DataBoundItem.

Returns:

TDataItem

The matching item, or the default value when no match is available.

Overrides: RadCollectionView<TDataItem>.Find(int, object)

When filtering, sorting, or grouping is active, this override currently returns the default value instead of searching by the bound object.

Gets the indexer's page for an item, or zero when paging is disabled.

C#
public override int GetItemPage(TDataItem item)
Parameters:itemTDataItem

The item whose page is requested.

Returns:

int

The page index when paging is enabled; otherwise, zero.

Overrides: RadCollectionView<TDataItem>.GetItemPage(TDataItem)

Finds an item in the view's currently exposed item sequence.

C#
public override int IndexOf(TDataItem item)
Parameters:itemTDataItem

The item to locate.

Returns:

int

The zero-based index in the current view or page, or -1 if the item is absent.

Overrides: RadCollectionView<TDataItem>.IndexOf(TDataItem)

Sets the last page as the current page.

C#
public override bool MoveToLastPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Overrides: RadCollectionView<TDataItem>.MoveToLastPage()

Refreshes the index and page position when filtering, sorting, grouping, or paging settings change.

C#
protected override void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters:ePropertyChangedEventArgs

The changed view property.

Overrides: RadCollectionView<TDataItem>.OnNotifyPropertyChanged(PropertyChangedEventArgs)

Applies source changes to the indexed view and publishes only changes that affect its projection.

C#
protected override void ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
Parameters:argsNotifyCollectionChangedEventArgs

The source collection change.

Overrides: RadCollectionView<TDataItem>.ProcessCollectionChanged(NotifyCollectionChangedEventArgs)

Reset and batch changes rebuild the view; item-level changes are processed against the active filter, sort, and group descriptors.

Rebuilds the indexed view, or resolves descriptor indexes when a deferred update is in progress.

C#
protected override void RefreshOverride()

Overrides: RadCollectionView<TDataItem>.RefreshOverride()