Articles in this section
Category / Section

How to solve the Row alignment behavior which changes anonymously

1 min read

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)
Please sign in to leave a comment
Access denied
Access denied