All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

TreeListView.BestFitModeOnSourceChange Property

Gets or sets how to calculate the optimal width required for all columns to completely display their contents when the grid’s ItemsSource is changed. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v21.1.dll

Declaration

public BestFitMode? BestFitModeOnSourceChange { get; set; }

Property Value

Type Default Description
Nullable<BestFitMode>

null

A mode that specifies how to calculate the optimal width.

Available values:

Name Description
Default

If this mode is assigned to the ColumnBase.BestFitMode of a grid column, this means that it obtains its value from the TableView.BestFitMode property of the owner view.

AllRows

The column width is calculated based on text of all cells within this column.

VisibleRows

The column width is calculated based on the values in the currently visible cells.

DistinctValues

The column width is calculated based on all distinct values in the underlying datasource.

Smart

In this mode, the column width is calculated as BestFitMode.AllRows if the total count of rows is less than 3,000, and as BestFitMode.DistinctValues if the total count of rows is greater than or equal to 3,000. Also, if the Smart mode is enabled, the TableView.CustomBestFit is raised, thus allowing you to manually calculate the column width.

Remarks

If the BestFitModeOnSourceChange property is set to null, the GridControl does not calculate the optimal width when the source is changed.

<dxg:GridControl Name="grid">
    <dxg:GridControl.View>
        <dxg:TreeListView Name="view" BestFitModeOnSourceChange="VisibleRows"/>
    </dxg:GridControl.View>
</dxg:GridControl> 
See Also