#MainWindow.xaml.cs
public MainWindow()
{
InitializeComponent();
this.pivotGrid1.Loaded += PivotGrid1_Loaded;
}
private void PivotGrid1_Loaded(object sender, RoutedEventArgs e)
{
//To hide the row grand totals alone.
int row = this.pivotGrid1.PivotEngine.RowCount - 2;
PivotCellInfo cellInfo = this.pivotGrid1.PivotEngine.PivotValues[row, 0];
if (cellInfo != null && cellInfo.CellType == (PivotCellType.RowHeaderCell | PivotCellType.GrandTotalCell))
{
this.pivotGrid1.InternalGrid.Model.RowHeights.SetHidden(row, row, true);
this.pivotGrid1.InternalGrid.InvalidateCells();
}
//To hide the column grand totals alone.
int col = this.pivotGrid1.PivotEngine.ColumnCount - this.pivotGrid1.PivotCalculations.Count - 1;
PivotCellInfo cellInfo1 = this.pivotGrid1.PivotEngine.PivotValues[0, col];
if (cellInfo1 != null && cellInfo1.CellType == (PivotCellType.HeaderCell | PivotCellType.ColumnHeaderCell | PivotCellType.GrandTotalCell))
{
for (int i = 0; i < this.pivotGrid1.PivotCalculations.Count; i++)
{
this.pivotGrid1.InternalGrid.Model.ColumnWidths.SetHidden(col + i, col + i, true);
this.pivotGrid1.InternalGrid.InvalidateCells();
}
}
}
|