PivotGridControl.BestFit() Method

Resizes all columns to fit their contents.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v20.1.dll


public void BestFit()
Public Sub BestFit


The BestFit method resizes all columns to display the entire contents. Call the method after the Pivot Grid loads the data and calculates its layout.


Do not call the BestFit method enclosed in an PivotGridControl.BeginUpdate - PivotGridControl.EndUpdate pair. An exception occurs: "This operation cannot be executed when pivot grid updates are blocked. The control's visual presentation is created after the EndUpdate method is called, so that you cannot perform actions that affect it within the BeginUpdate and EndUpdate method calls."

The method applies to the following fields:


Use the PivotGridControl.BestFitColumnArea and PivotGridControl.BestFitRowArea methods to resize columns that correspond only to column and row fields respectively.

See Also