Skip to main content
All docs
V25.1
  • 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

    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