WPF Data Grid and TreeList - Automatic Best Fit

WPF Team Blog
14 May 2020

Our WPF Data Grid and TreeList v20.1 can now automatically and dynamically resize columns during scroll and edit operations.

To demonstrate this feature, we recently published the following YouTube video.

Video Script: WPF Data Grid and WPF TreeList v20.1 - Dynamic Column Resizing

Enable Automatic Best Fit

To activate this new WPF Grid and TreeList option, simply set the appropriate column's Width property to Auto.

    <dxg:GridColumn FieldName="FullName" Width="3*"/>
    <dxg:GridColumn FieldName="BirthDate" Width="2*"/>
    <dxg:GridColumn FieldName="JobTitle" Width="Auto" AllowResizing="False"/>
    <dxg:GridColumn FieldName="Phone" Width="2*"/>

Best Fit During Source Change

We also added a BestFitModeOnSourceChange option. This allows our WPF Data Grid or TreeList to calculate the optimal width for all columns when the ItemsSource changes.

<dxg:GridControl Name="grid">
		<dxg:TableView Name="view" BestFitModeOnSourceChange="VisibleRows"/>


As always, we welcome your thoughts/opinions. Please post a comment below and let us know what you think about Automatic Best Fit.

FREE DevExpress Xamarin UI Controls

Deliver high-impact native mobile apps with our feature-rich Data Grid, Scheduler, Chart, TabView, Editors, and utility controls. Reserve your free copy today!
Andrew Tinkler
Andrew Tinkler
Keep up the good work!
15 May 2020

Please login or register to post comments.