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 Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.