Skip to main content

Pivot Grid Fields

  • 3 minutes to read

Pivot Grid Fields supply data to PivotGridControl. Fields are visualized with field headers. You can drag-and-drop field between Pivot Grid areas to modify the Pivot Grid layout.

Create and Position Pivot Grid Fields

To visualize data in the Pivot Grid, create Pivot Grid fields and position them in the header areas.

A field can be positioned within one of four areas: Column, Row, Data, and Filter Header Area. The field’s function depends on the area in which it is located:

cdFieldsLocation1

Column Header Area
Lists field values along the control’s top edge. Field values are column headers.
Row Header Area
Lists field values along the control’s left edge. Field values are row headers.
Data Header Area
Calculates summaries against the fields in column and row areas. The summaries are calculated for all cells, and each cell is identified by a column and a row.
Filter Header Area
Displays headers of filter fields. Filter fields allow users to filter the entire Pivot Grid to display data for the predefined values from the filter dropdown list.

Refer to the following article for more information: Field Layout.

Follow the steps below to create and position fields in code:

  1. Create a PivotGridField object and add it to the PivotGridControl.Fields collection.
  2. Specify the field’s area and position within this area. For this, use the PivotGridFieldBase.Area and PivotGridFieldBase.AreaIndex properties. AreaIndex can be set only after the field is added to the control’s field collection.

Bind Pivot Grid Fields to Data

Pivot Grid uses the Binding API to bind Pivot Grid fields to data. Data binding sources can be columns in a data source, calculated expressions, or window calculations.

Refer to the following help topics for more information on how to bind Pivot Grid fields to different data binding sources:

Tip

To obtain distinct field values which can be used to filter a Pivot Grid’s data, call the PivotGridFieldBase.GetUniqueValues method. See the Filtering Overview topic for more information on Pivot Grid’s data filtering.

Obtain Field Data

Use the following methods to obtain a field’s data:

PivotGridFieldBase.GetUniqueValues
Returns an array of the unique values which are stored in the underlying data source in the current field.
PivotGridFieldBase.GetAvailableValues
Returns a list of field values that are not excluded by filters applied to other fields and can be displayed.
PivotGridFieldBase.GetVisibleValues
Returns the field values currently shown in the PivotGrid.

Filtering

You can apply filter criteria to Pivot Grid fields to display specific records.

Refer to the Filtering section for more information.

Example

See Also