Articles in this section

How to display the particular pivot computation item with different color

 

C#

//Place this code within the MainWindow()
this.pivotGrid1.ApplyTemplate(); 
this.pivotGrid1.InternalGrid.PrepareRenderCell += new Syncfusion.Windows.Controls.Grid.GridPrepareRenderCellEventHandler(InternalGrid_PrepareRenderCell);
void InternalGrid_PrepareRenderCell(object sender, Syncfusion.Windows.Controls.Grid.GridPrepareRenderCellEventArgs e)
{
//Applying Styles to Quantity PivotComputation Cell Values
if (e.Style.CellValue != null)
{
if (e.Style.CellValue.ToString() == "Quantity" && !check)
{
columnIndex = e.Style.ColumnIndex;
check = true;
}
}
if ((e.Style.ColumnIndex - columnIndex) % this.pivotGrid1.PivotCalculations.Count == 0 && check)
{
if (e.Style.RowIndex > 2 && e.Cell.ColumnIndex != 0 && e.Cell.ColumnIndex > this.pivotGrid1.PivotRows.Count)
{
e.Style.Background = Brushes.Cyan;
e.Style.Foreground = Brushes.Magenta;
}
} 
//Code to apply the style for Amount Computationvaluecells
if (e.Style.RowIndex > 2 && e.Cell.ColumnIndex != 0 && e.Cell.ColumnIndex % this.pivotGrid1.PivotCalculations.Count == 0)
{
e.Style.Background = Brushes.Pink;
e.Style.Foreground = Brushes.Magenta;
}
}
 

 

 

 

 

 

D:\documentation\PivotGrid\Styles Applied.PNG

                              Figure: Pivot Grid shows customized value cell

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied