Skip to main content

PivotGridControl.BestFit(PivotGridField, Boolean, Boolean) Method

Resizes the columns and rows which correspond to the specified field, to the minimum width or height required to completely display their contents.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v24.2.dll

NuGet Package: DevExpress.Wpf.PivotGrid

Declaration

public void BestFit(
    PivotGridField field,
    bool fitWidth,
    bool fitHeight
)

Parameters

Name Type Description
field PivotGridField

A PivotGridField object that represents the pivot grid field.

fitWidth Boolean

true to best fit the column’s width (for column fields), or width of the field values column (for row fields); otherwise, false.

fitHeight Boolean

true to best fit the row’s height (for row fields), or height of the field values row (for column fields); otherwise, false.

Remarks

When the PivotGridControl.RowTotalsLocation property is set to FieldRowTotalsLocation.Tree, calling the BestFit method for row fields has no effect. In this instance, to apply best fit to row fields, use another overload of this method, which takes the area parameter, and pass the FieldArea.RowArea value as this parameter.

Note

The Best Fit is available only after the Pivot Grid Control has been loaded in the visual tree.

To learn more, see Best Fit.

See Also