PivotItem in WPF Pivot Grid

15 Jul 20213 minutes to read

A pivot item is a container for items in the pivot grid control. An item in a pivot table field provides the information needed to define an item. The items are individual data entries in a field category. The pivot item object is a member of the pivot items collection and consists of the following fields.

  • FieldHeader: Gets or sets the title you want to view in the header for the pivot item.
  • FieldMappingName: Gets or sets the pivot item property’s mapping name.
  • TotalHeader: Gets or sets the string you want to append to the pivot item’s summary cells.
  • Comparer: Gets or sets the IComparer object used for sorting. If this value is null, then sorting will be performed under the assumption that this field is IComparable.
  • Format: Gets or sets the format string for the specified field.
  • ShowSubTotal: Gets or sets whether the subtotal for this item can be shown or hidden.
  • AllowRunTimeGroupByField: Gets or sets a value to enable or disable grouping for the pivot item.
  • AllowFilter: Enables or disables filtering for the pivot item.
  • AllowSort: Enables or disables sorting for the pivot item.

Defining pivot item in XAML

Create a new pivot item by using the PivotGridControl.PivotItem class. A pivot item can be either a PivotRow or PivotColumn. Refer to the following code sample.

  • XAML
  • <Grid>
            <syncfusion:PivotGridControl Name="pivotGrid" HorizontalAlignment="Left" VerticalAlignment="Top" ItemSource="{Binding Source={StaticResource data}}" VisualStyle="Metro">
                    <syncfusion:PivotItem FieldHeader="Product" FieldMappingName="Product" TotalHeader="Total" />
                    <syncfusion:PivotItem FieldHeader="Country" FieldMappingName="Country" TotalHeader="Total" />

    Defining pivot item in code-behind

    Include the Syncfusion.PivotAnalysis.Base in the MainWindow.xaml.cs file, and then define the pivot item for row and column. Add the defined pivot item to the pivot rows and pivot columns collections of the pivot grid control. Refer to the following code sample.

  • C#
  • public MainWindow() {
        this.Loaded += MainWindow_Loaded;
    void MainWindow_Loaded(object sender, RoutedEventArgs e) {
        PivotGridControl pivotGrid = new PivotGridControl();
        PivotItem m_PivotItem = new PivotItem() {
            FieldHeader = "Product", FieldMappingName = "Product", TotalHeader = "Total"
        PivotItem n_PivotItem = new PivotItem() {
            FieldHeader = "Country", FieldMappingName = "Country", TotalHeader = "Total"
        // Adding PivotItem to PivotRows
        // Adding PivotItem to PivotColumns


    You can refer to our WPF Pivot Grid feature tour page for its groundbreaking feature representations. You can also explore our WPF Pivot Grid example to knows how to organizes and summarizes business data and displays the result in a cross-table format.