Articles in this section

How to solve the Row alignment behavior which changes anonymously

Row alignment behavior can be solved by handling codes considering ShowCalculationsAsColumns, PivotCalculations. The following code explains the same.

C#

this.pivotGridControl1.InternalGrid.PrepareRenderCell += (s, eventArgs) =>

{

if (eventArgs.Cell.RowIndex > (pivotGridControl1.PivotColumns.Count - (this.pivotGridControl1.ShowCalculationsAsColumns ? 0: 1) - (this.pivotGridControl1.PivotCalculations.Count == 1 ? 1:0) + (!this.pivotGridControl1.ShowCalculationsAsColumns && this.pivotGridControl1.PivotCalculations.Count==1? 1:0 ) ))

{

//For Row headers and value cells

eventArgs.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

}

else if (eventArgs.Style.CellType.Equals("ExpanderCell"))

{

//For Column Headers that has only expander cells

(eventArgs.Style as GridStyleInfo).HorizontalAlignment = System.Windows.HorizontalAlignment.Center;

}

else

{

//For Column Headers that has static cells

eventArgs.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;

}

};

 

 

C:\Users\labuser\Dropbox\Screenshots\Screenshot 2014-06-10 18.29.28.png

Figure: Pivot Grid shows customized row alignment

 

 

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