Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataGridView.BestFitItemsCount Property

Gets or sets the number of cells used to calculate the best-fit width for all columns. This is a bindable property.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

#Declaration

C#
public int BestFitItemsCount { get; set; }

#Property Value

Type Default Description
Int32 20

The number of cells used to calculate the best-fit width for all columns.

#Remarks

If you set the AutoBestFitColumns property to true, the best-fit column width is calculated based on the maximum content width within specified cells. The column width calculation starts from the first top visible cell. Use the DataGridView.BestFitItemsCount property to specify the number of cells used to calculate the best-fit width for all columns.

Note that the DataGridView.BestFitItemsCount property does not affect CheckBoxColumn, ImageColumn, and TemplateColumn.

For more information, refer to the following section: Grid Column Best-Fit Width.

See Also