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.CalcBestFitAsync(GridColumn, Boolean) Method

Calculates the best-fit width for all columns or for the specified column asynchronously. The CalcBestFitAsync method returns Task that completes when the column width calculates.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

#Declaration

C#
public Task CalcBestFitAsync(
    GridColumn column = null,
    bool waitImageLoading = true
)

#Optional Parameters

Name Type Default Description
column GridColumn null

The target column or all columns (if null).

waitImageLoading Boolean True

true if the method calculates the best-fit width immediately for columns (or for the specified column) when column data is fully loaded; otherwise, the method calculates the best-fit width for all columns except ImageColumn. The best-fit width for ImageColumn is calculated when the column data is fully loaded.

#Returns

Type Description
Task

An operation that executes asynchronously and is completed together with the column width calculation process.

#Remarks

Set the AutoBestFitColumns property to true to calculate the column width based on the specified BestFitMode.

The DataGridView recalculates the column width automatically only in response to changes in the bound data source. You can call the CalcBestFitAsync() method to force column width recalculation.

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

See Also