windowsforms-1918-controls-and-libraries-pivot-grid-fundamentals-pivot-grid-fields.md
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.
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:
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:
AreaIndex can be set only after the field is added to the control’s field collection.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.
Use the following methods to obtain a field’s data:
PivotGridFieldBase.GetUniqueValuesReturns an array of the unique values which are stored in the underlying data source in the current field.PivotGridFieldBase.GetAvailableValuesReturns a list of field values that are not excluded by filters applied to other fields and can be displayed.PivotGridFieldBase.GetVisibleValuesReturns the field values currently shown in the PivotGrid.
You can apply filter criteria to Pivot Grid fields to display specific records.
Refer to the Filtering section for more information.
See Also