TableView.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.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
#Declaration
public BestFitMode? BestFitModeOnSourceChange { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Nullable<Best |
null | A mode that specifies how to calculate the optimal width. |
Available values:
Name | Description |
---|---|
Default | If this mode is assigned to the Column |
All |
The column width is calculated based on text of all cells within this column. |
Visible |
The column width is calculated based on the values in the currently visible cells. |
Distinct |
The column width is calculated based on all distinct values in the underlying datasource. |
Smart | In this mode, the column width is calculated as Best |
#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:TableView Name="view" BestFitModeOnSourceChange="VisibleRows"/>
</dxg:GridControl.View>
</dxg:GridControl>
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the BestFitModeOnSourceChange property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.