Back to Devexpress

PivotGridControl.BestFit(PivotGridField) Method

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-dot-bestfit-x28-devexpress-dot-xtrapivotgrid-dot-pivotgridfield-x29.md

latest3.6 KB
Original Source

PivotGridControl.BestFit(PivotGridField) Method

Resizes the column(s) related to the specified field to fit the longest text currently displayed in the column.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public void BestFit(
    PivotGridField field
)
vb
Public Sub BestFit(
    field As PivotGridField
)

Parameters

NameTypeDescription
fieldPivotGridField

A PivotGridField object that is the field whose columns are resized.

|

Remarks

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.

Important

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:

Tip

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

See Also

Width

BestFit()

ApplyBestFitOnFieldDragging

BestFitColumnArea()

BestFitRowArea()

BestFitDataHeaders(Boolean)

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace