Resizes the field’s column(s) to fit the longest text currently displayed in the column.
NuGet Package: DevExpress.Win.PivotGrid
The BestFit method resizes the columns related to the current field to display the entire field 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:
- a data field;
- a row field;
- a column field, if the column is not nested (the field is the last (and lowest) in the column field hierarchy and there is only one data field).