Version

Grouping Overview (xamDataGrid)

Topic Overview

Purpose

This topic gives an overview of the xamDataGrid™ control’s grouping functionality allowing users to group data into more readable and navigable arrangements.

Required background

The following topic is a prerequisite to understanding this topic:

Topic Purpose

This topic introduces the xamDataGrid control and various elements, on which control is composed.

Grouping Overview

Grouping Overview

Grouping, the ability to present related data together is one of the xamDataGrid important functionalities that the user can perform using either the UI or code.

Grouping also allows users to drag field headers from multiple field layouts into the group-by area.

Grouping Overview 1.png

There is a second option, which displays a button for each field in the default layout underneath the group-by area. Users can drag these buttons into the group-by area to group records in the default field layout; however, this option does not allow users to group records using fields in multiple field layouts. This option is backward compatible with previous releases.

Grouping Overview 2.png

Main Settings Summary

Main settings summary chart

The xamDataGrid is highly user configurable using these settings.

Settings Description

FieldSettings class property determines if users can initiate a group-by operation through the UI for the field.

This property’s default setting is True.

This FieldSettings class property determines whether grouped field cells are visible.

This property’s default value is Visible.

This DataPresenterBase class property gets or sets the GroupByArea control.

This DataPresenterBase class property gets or sets how fields are grouped by users.

This DataPresenterBase class property gets or sets the GroupByAreaMulti control, used for creating Outlook style groupings across multiple FieldLayouts.

This DataPresenterBase class property determines the location of the GroupByArea display.

If set to None, the GroupByArea is not displayed.

This property of FieldSettings class, if specified, sorts the GroupByRecords following their creation. This operation requires a second sort pass on the `GroupByRecord`s.

This property of FieldLayoutSettings class specifies how the data presenter will perform grouping operations.

Use this property of FieldSettings class, to specify a custom evaluator for group-by records, which determines the group breaks.

This property of FieldSettings class determines DataRecord grouping.

GroupByArea

  • You can set this GroupByArea property to a control of type GroupByArea to attach an external group-by area to the DataPresenter or to modify properties of the GroupByArea control. This group-by area only allows grouping by fields in the default field layout.

Note
Note

In order for the Data Presenter to use the GroupByArea control the GroupByAreaMode property must first be set to DefaultFiledLayoutOnly.

GroupByAreaMode

This property serves three separate purposes.

  • Primary purpose is to determine whether users can group records using fields from multiple field layouts. For example, if you have a nested hierarchy of Customer and Order data items, this property determines if users can group the Customer data items and the Order data items.

  • Secondary purpose is to determine how much space the group-by area will occupy when you enable multiple field layout grouping. If you use the MultipleFieldLayoutCompact setting, the control displays the group-by criteria, in a single line, in the group-by area. However, with the MultipleFiledLayoutsFull sett``ing, the xamDataGrid will display each unique field layout on a separate line in the group-by area.

  • Tertiary purpose is to switch between the two different UI options available for grouping records. If you enable grouping only on the default field layout and prefer the older grouping UI, that is to say use the DefaultFieldLayoutOnly, the group-by area will display buttons for the fields in the default field layout. Otherwise, users will be able to drag field headers from multiple field layouts into the group-by area.

GroupByAreaMulti

You can set this property to a GroupByAreaMulti control to attach an external group-by area to the DataPresenter or to modify properties of the GroupByAreaMulti control.

Note
Note

For this group-by area to work the GroupByAreaMode property must be set to either MultipleFieldLayoutsCompact or MultipleFieldLayoutsFull.

GroupByAreaLocation

This property allows you to set the location of the group-by area.

Note
Note

The control is unaffected by this property when using an external group-by area.

GroupByComparer

You can provide your own sorting logic for group-by records by setting this property to an object that implements the IComparer interface.

GroupByEvaluationMode

The GroupByEvaluationMode enumeration has the following members:

Member Description

Auto

The data presenter performs the grouping operations internally.

Default

Default resolves to Auto .

UseCollectionView

If underlying data source is ICollectionView, the data presenter uses its GroupDescriptions property to perform the grouping operation. The control modifies the collection view’s GroupDescriptions and SortedDescriptions collections.

Using this mode control strips out any duplicate field entries.

GroupByEvaluator

This property can be set to a custom implementation of the IGroupByEvaluator interface. This interface has a read-only SortComparer property of the IComparer type. The IGroupByEvaluator interface’s SortComparer property should return a comparer that is logically consistent with the implementation of its DoesGroupContainRecord method.

In other words, the sort order logic is consistent with the grouping logic, and all DataRecord`s that end up in the same group should return zero from the comparer’s Compare method when being compared with another `DataRecord from the same group.

GroupByMode

The GroupByMode property gets or sets a FieldGroupByMode enumeration. The property allows you to specify which of default GroupByEvaluators to use when grouping a field.

Note
Note

Specifying a GroupByEvaluator causes this property to be ignored.

Unless set, this property reverts to its default value to one of the following options, based on EditAsType property of the FieldSettings class.

Value Description

Text

This value is set if EditAsType is of type string.

OutlookDate

This value is set if EditAsType is on type DateTime.

Value

This value is set if EditAsType is not of type string or DateTime.

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic describes how you can change the location of group-by area.

This topic describes how you can detach the group-by area from Data Presenter control and create an external group-by area in your window.

This topic gives describes how you can prevent the group-by area from displaying.

This topic describes how you can modify the layout of the field headers and field layout descriptions in the group-by area.

This topic explains how you can sort and/or group using XAML or procedural code without users clicking a field label or dragging a field label into the group-by area.

This topic gives describes what actions are perfumed internally by xamDataGrid ’s internal comparer during sorting and grouping process.

This topic gives an overview of sorting functionality of xamDataGrid . xamDataGrid display and handles the sorting for you. Your users can sort columns by clicking the column headers, allowing them to view the grid data in the order they want.

This topic describes user interactions for sorting records when xamDataGrid records are grouped.