datagrid文本内容自动换行
<Style x:Key="WrapTextBlock" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="Auto" />
</Style>
elementstyle 绑定该style资源
本文介绍了一种在DataGrid中使文本内容自动换行的方法,通过定义一个样式资源,设置TextBlock的TextWrapping属性为Wrap,并将其Height属性设置为Auto,实现DataGrid单元格内文本的自动换行。
<Style x:Key="WrapTextBlock" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="Auto" />
</Style>
elementstyle 绑定该style资源

被折叠的 条评论
为什么被折叠?