This example is made based on the How to provide custom summary values for Total, Grand Total and ordinary cells example and illustrates how a cell type can be checked in the CustomSummary event handler.
When the PivotGridControl.CustomSummary event is used to provide custom values for only Total or Grand Total cells, you can use the ColumnField and RowField properties to determine the kind of a processed cell. You can use the following rules to determine that a cell is being processed:
2. If both ColumnField and RowField are last fields in a corresponding area, this means that this is an ordinary cell.
3. In other cases, this is a Total cell.
This example demonstrates how to determine the value type. To calculate summary values, you can use one of the following solutions:
2. Calculate the value by iterating through DrillDownDataSource. This solution is demonstrated in the E2136: How to: Implement Custom Summary example.
3. Calculate the value by summary values calculated for low level cells. This is the most complex approach demonstrated in the T158425: How to calculate Total cell values based on the low level Cell summary values example. In this example ASPxPivotGrid is used, but the approach should be similar.
Files to look at:• CustomTotalGrandTotalBehavior.cs (VB: CustomTotalGrandTotalBehavior.vb)
• MainWindow.xaml (VB: MainWindow.xaml)
• MyDataContext.cs (VB: MyDataContext.vb)