HandyControl
HandyControl copied to clipboard
DataGrid中的文本段落,设置允许折行时,Cell不能自适应高度
Describe the bug
新建一个DataGrid,其中某列使用TextBlock显示长文本,该TextBlock设置TextWrapping属性为"Wrap",实际效果确实有折行,但是单元格高度固定无法自适应,该问题在3.2.0版本没有出现,在后续版本直到最新的3.5.1上都有问题。
Steps to reproduce the bug
1、新建一个DataGrid。 2、新增一列用于文本显示,添加一个TextBlock。 3、设置TextBlock的TextWrapping属性为"Wrap"。 4、为TextBlock的Text属性绑定一个长文本。 5、编译运行。
Expected behavior
期待能够在折行的情况下,Cell高度自适应。
Screenshots
正常的效果,3.2.0版本是正常的:
有问题的效果,3.2.0直到3.5.1有该问题:
NuGet package version
HandyControl 3.3.0
IDE
Visual Studio 2022
Framework type
.Net Framework 4.8
Windows version
Windows 11 (22000)
Additional context
示例代码:
<DataGridTemplateColumn Width="100" Header="testText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Detail}" TextWrapping="Wrap" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
No response