TreeListView.CustomBestFit Event
Allows you to manually calculate the optimal width for a column(s).
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.1.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Event Data
The CustomBestFit event's data class is DevExpress.Xpf.Grid.TreeList.TreeListCustomBestFitEventArgs.
Remarks
The CustomBestFit event occurs before the Best Fit feature is applied to a column. Handle this event to manually calculate the optimal width for a column. You can do the following:
Change the Best Fit Mode
The CustomBestFit event occurs if the ColumnBase.BestFitMode property is set to BestFitMode.Smart or BestFitMode.Default. By default, the column’s optimal width is calculated as BestFitMode.AllRows if the total number of cells is less than 3,000, and as BestFitMode.DistinctValues if the total number of cells is greater than or equal to 3,000. Use the event parameter’s CustomBestFitEventArgsBase.BestFitMode property to select the required mode.
Manually Specify Rows
Populate the CustomBestFitEventArgsBase.BestFitRows collection with rows that should be taken into account when calculating the optimal width of CustomBestFitEventArgs.Column.