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

Used to build groups from indexer

Definition

Namespace:Telerik.WinControls.Data

Assembly:Telerik.WinControls.dll

Type Parameters:

T

The data-item type grouped by this builder.

Syntax:

C#
public class GroupBuilder<T> where T : IDataItem

Inheritance: objectGroupBuilder<T>

Derived Classes: GridGroupBuilder

Constructors

Initializes a group builder that reads items and descriptors from the specified index.

C#
public GroupBuilder(Index<T> index)
Parameters:indexIndex<T>

The index whose collection view supplies the grouping descriptors and items.

Properties

Gets the collection view associated with this builder.

C#
public RadCollectionView<T> CollectionView { get; }

Comparer

IComparer<Group<T>>

Gets or sets the comparer used to order sibling groups.

C#
public virtual IComparer<Group<T>> Comparer { get; set; }

Gets the default group predicate.

C#
public virtual GroupPredicate<T> DefaultGroupPredicate { get; }
Property Value:

The group predicate.

Gets or sets the group predicate.

C#
public virtual GroupPredicate<T> GroupPredicate { get; set; }
Property Value:

The group predicate.

Gets the groups.

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

The groups.

Gets a value indicating whether [needs refresh].

C#
public bool NeedsRefresh { get; }
Property Value:

true if [needs refresh]; otherwise, false.

Gets the version used by nested data-item groups to detect when their group hierarchy must be rebuilt.

C#
protected int Version { get; }

Methods

Reuses a cached group or creates one through the collection view's group factory.

C#
protected virtual Group<T> GetGroup(GroupCollection<T> cache, Group<T> newGroup, Group<T> parent, object key, int level)
Parameters:cacheGroupCollection<T>

Previously built groups that may be reused.

newGroupGroup<T>

The group key used to locate a cached match.

parentGroup<T>

The parent group, or null for a root group.

keyobject

The key passed to the group factory when a new group is needed.

levelint

The hierarchy level of the group.

Returns:

Group<T>

The cached group or the newly created group.

Gets the cached group containing an item, building the groups first when needed.

C#
public Group<T> GetItemGroup(T item)
Parameters:itemT

The item whose group is requested.

Returns:

Group<T>

The containing group, or null if the item has no group in the current hierarchy.

Reads and normalizes the item field used as a group key.

C#
protected virtual object GetItemKey(T item, SortDescriptor descriptor)
Parameters:itemT

The item being grouped.

descriptorSortDescriptor

The descriptor identifying the field ordinal.

Returns:

object

The field value, with DBNull converted to null and colors converted to strings.

Performs the grouping operation for specified items.

C#
public virtual GroupCollection<T> Perform(IReadOnlyCollection<T> items, int level, Group<T> parent)
Parameters:itemsIReadOnlyCollection<T>

The items.

levelint

The level.

parentGroup<T>

The parent.

Returns:

GroupCollection<T>

The groups built for this level. The collection is empty when the level has no descriptor, the descriptor has no group names, or any group field has an unresolved property index. If paging is applied before grouping, root-level groups are built from the current page only.