我已将 DataGrid 绑定(bind)到我的集合,我需要将每一行的高度绑定(bind)到我的属性。
这可能吗?还是有另一种方法,将每一行的高度与集合中的相应属性相关联?
最佳答案
您可以在 RowStyle
中绑定(bind) Height
。
假设您有一个名为 RowHeight
的属性
<DataGrid ItemsSource="{Binding ...}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Height" Value="{Binding RowHeight}"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
关于c# - wpf.DataGrid 中的自动行高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11273797/