Back to Devexpress

DataGridView.CalcBestFitAsync(GridColumn, Boolean) Method

maui-devexpress-dot-maui-dot-datagrid-dot-datagridview-dot-calcbestfitasync-x28-devexpress-dot-maui-dot-datagrid-dot-gridcolumn-system-dot-boolean-x29.md

latest2.4 KB
Original Source

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

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

Optional Parameters

NameTypeDefaultDescription
columnGridColumnnull

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

TypeDescription
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

DataGridView Class

DataGridView Members

DevExpress.Maui.DataGrid Namespace