Binding PivotSchemaDesigner in WPF Pivot Grid

15 Jul 20215 minutes to read

The pivot schema designer can be bound to the pivot grid with the help of the PivotControl property. After creating a pivot grid, a new pivot schema designer is created using the PivotSchemaDesigner class and bound to the pivot grid control using the PivotControl property. This can be achieved either in XAML or code-behind.

For XAML, refer to the following code sample.

  • XAML
  • <Grid>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width=".35*"/>
            <syncfusion:PivotGridControl HorizontalAlignment="Left" Name="pivotGrid" VerticalAlignment="Top" VisualStyle="Metro"
                 EnableValueEditing="True" ItemSource="{Binding   Source={StaticResource data}}" >
                    <syncfusion:PivotItem FieldHeader="Product" FieldMappingName="Product" TotalHeader="Total" />
                    <syncfusion:PivotItem FieldHeader="Date" FieldMappingName="Date" TotalHeader="Total"/>
                    <syncfusion:PivotItem FieldHeader="Country" FieldMappingName="Country" TotalHeader="Total" />
                    <syncfusion:PivotItem FieldHeader="State" FieldMappingName="State" TotalHeader="Total"/>
                    <syncfusion:PivotComputationInfo CalculationName = "Total" FieldName = "Amount" Format="C" SummaryType="DoubleTotalSum" />
                    <syncfusion:PivotComputationInfo CalculationName = "Total" FieldName = "Quantity" SummaryType="Count" />
            <syncfusion:PivotSchemaDesigner Grid.Column="1" Name="shemaDesginer" VisualStyle="Metro" PivotControl="{Binding ElementName=pivotGrid}"></syncfusion:PivotSchemaDesigner>

    For code-behind, refer to the following code sample.

  • C#
  • public partial class MainWindow : Window
            PivotGridControl pivotGrid = new PivotGridControl();
            PivotSchemaDesigner schemaDesigner = new PivotSchemaDesigner();
            public MainWindow()
                pivotGrid.ItemSource = ProductSales.GetSalesData();
                PivotItem m_PivotItem = new PivotItem() { FieldHeader = "Product", FieldMappingName = "Product", TotalHeader = "Total" };
                PivotItem m_PivotItem1 = new PivotItem() { FieldHeader = "Date", FieldMappingName = "Date", TotalHeader = "Total" };
                PivotItem n_PivotItem = new PivotItem() { FieldHeader = "Country", FieldMappingName = "Country", TotalHeader = "Total" };
                PivotItem n_PivotItem1 = new PivotItem() { FieldHeader = "State", FieldMappingName = "State", TotalHeader = "Total" };
                // Adding PivotItem to PivotRows
                // Adding PivotItem to PivotColumns
                PivotComputationInfo m_PivotComputationInfo = new PivotComputationInfo() { CalculationName = "Amount", FieldName = "Amount", Format = "C", SummaryType = Syncfusion.PivotAnalysis.Base.SummaryType.DoubleTotalSum };
                PivotComputationInfo m_PivotComputationInfo1 = new PivotComputationInfo() { CalculationName = "Quantity", FieldName = "Quantity", SummaryType = Syncfusion.PivotAnalysis.Base.SummaryType.Count };
                schemaDesigner.PivotControl = pivotGrid;
                Grid.SetColumn(schemaDesigner, 1);



    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.