c# - wpf.DataGrid 中的自动行高

标签 c# wpf binding datagrid row-height

我已将 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/

相关文章:

c# - 对象值变化

C# WPF MVVM Caliburm-micro 动态绑定(bind) `GradientStops`

c# - 通过TCP客户端发送和接收大量数据并没有读取所有数据

c# - 如何使用 PRISM 在 WPF 中导航并绑定(bind) DataContext

c# - 处理 Youtube 嵌入限制

c# - 以样式在列表框 ItemContainer 上指定数据上下文类型

wpf - MVVM方式使用不同的控件来编辑不同的对象

c# - 上下文菜单条 -> 更改突出显示项目的颜色

c# - 隐藏窗口时如何获取 Process.MainWindowHandle

WPF - 数据绑定(bind)示例