Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Data Shaping
   [Expand]Data Analysis
     Field Location and Order
     Data Cell Layout
     Field Groups
    [Expand]Customization Form
     Best Fit
     Save and Restore Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Design-time Features
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Best Fit

The PivotGridControl control allows you to calculate and apply the optimal width required for a column to display its entire content.

Expanded Best Fit Overview

The Best Fit feature can be applied to an individual column, as well as to all columns displayed within the PivotGridControl.

Use the PivotGridControl.BestFit method without parameters to apply the Best Fit feature to all columns.

Use the PivotGridControl.BestFit method with a PivotGridField parameter (or the PivotGridField.BestFit method) to specify the field for which columns should be automatically adjusted.

The following table lists the methods used to apply the Best Fit feature.

Method Description
PivotGridControl.BestFit Depending on the specific overload, applies the Best Fit feature to all columns or to the columns that correspond to the specified field.
PivotGridField.BestFit Resizes the columns that correspond to the current field to the minimum width required to completely display the column's contents.
PivotGridControl.BestFitColumnArea Resizes columns in the Data Area to the minimum width required to completely display their contents.
PivotGridControl.BestFitRowArea Resizes columns that display row field values to the minimum width required to completely display their contents.

To disable the Best Fit feature, set the PivotGridOptionsBehaviorBase.BestFitMode property to PivotGridBestFitMode.None.


The Best Fit feature cannot be applied within the PivotGridControl.BeginUpdate and PivotGridControl.EndUpdate method calls.

Expanded End-User Capabilities

End-users can resize columns to the optimal width (if allowed) by double-clicking the right border of the column.

Expanded Best Fit Options

You can specify which visual elements are considered when calculating the optimal width for columns. To do this, use the PivotGridOptionsBehaviorBase.BestFitMode property. By default, the column width is calculated based on the content of data cells, field values and field headers.

To allow automatic Best Fit for all fields that have been dragged and dropped to another location, use the PivotGridOptionsBehavior.ApplyBestFitOnFieldDragging property.

Use the PivotGridOptionsBehavior.BestFitConsiderCustomAppearance property to specify whether appearance settings made while handling the PivotGridControl.CustomAppearance event should be taken into account when calculating minimum column width for Best Fit. Note that Best Fit performs slower if the PivotGridOptionsBehavior.BestFitConsiderCustomAppearance property is set to true.

Is this topic helpful?​​​​​​​