WindowsCommunityToolkit
WindowsCommunityToolkit copied to clipboard
WinUI 3 DataGrid (CommunityToolkit.WinUI.UI.Controls) - Resize of height is not working when user shrink or expand column
Describe the bug
WinUI 3 DataGrid (CommunityToolkit.WinUI.UI.Controls) - Resize of height is not working when user shrink or expand column
<ctWinUI:DataGrid x:Name="DataGrid" AutoGenerateColumns="False" CanUserSortColumns="True" controls:Grid.Row="1" GridLinesVisibility="All" Sorting="DataGrid_Sorting"> ctWinUI:DataGrid.Resources <SolidColorBrush x:Key="DataGridColumnHeaderBackgroundBrush" Opacity=".5" /> <Style x:Key="WrapText" TargetType="TextBlock"> <Setter Property="TextWrapping" Value="Wrap" /> </Style> </ctWinUI:DataGrid.Resources> ctWinUI:DataGrid.RowStyle
</ctWinUI:DataGrid.RowStyle> ctWinUI:DataGrid.Columns <ctWinUI:DataGridTextColumn Binding="{Binding Rank}" Header="Rank" Tag="Rank" /> <ctWinUI:DataGridComboBoxColumn Binding="{Binding Mountain}" Header="Mountain" Tag="Mountain" /> <ctWinUI:DataGridTextColumn Binding="{Binding Height_m}" Header="Height (m)" Tag="Height_m" /> <ctWinUI:DataGridTextColumn Binding="{Binding Range}" Header="Range" Tag="Range" /> <ctWinUI:DataGridTextColumn Binding="{Binding Parent_mountain}" ElementStyle="{StaticResource WrapText}" Header="Parent Mountain" Tag="Parent_mountain" /> </ctWinUI:DataGrid.Columns> </ctWinUI:DataGrid>
public HomePage() { this.InitializeComponent(); this.Loaded += HomePage_Loaded; }
private async void HomePage_Loaded(object sender, RoutedEventArgs e) { DataGrid.ItemsSource = await _dataSource.GetDataAsync(); DataGrid.Columns[0].SortDirection = ctWinUI.DataGridSortDirection.Ascending;
DataGrid.RowHeight = double.NaN;
}
Regression
No response
Reproducible in sample app?
- [ ] This bug can be reproduced in the sample app.
Steps to reproduce
Already given
Expected behavior
When we have set Wrap data for any column and if user resize (shrink) column and then expand column. data grid is not refreshing its height based on content. hence so many blank spaces. Please refer my both snapshots.
Screenshots
Windows Build Number
- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [X] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [ ] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)
Other Windows Build number
No response
App minimum and target SDK version
- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [X] Windows 10, version 2004 (Build 19041)
- [ ] Other (specify)
Other SDK version
No response
Visual Studio Version
2022
Visual Studio Build Number
No response
Device form factor
Desktop
Nuget packages
No response
Additional context
No response
Help us help you
Yes, but only if others can assist.