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:GridControl.Columns>
<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*"/>
</dxg:GridControl.Columns>
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:GridControl.View>
<dxg:TableView Name="view" BestFitModeOnSourceChange="VisibleRows"/>
</dxg:GridControl.View>
</dxg:GridControl>
Feedback
As always, we welcome your thoughts/opinions. Please post a comment below and let us know what you think about Automatic Best Fit.