【问题标题】:Set datagrid column width to star in codebehind将数据网格列宽设置为代码隐藏中的星号
【发布时间】:2015-09-09 23:37:36
【问题描述】:

我目前正在尝试将 DataGrid 中的最后一列设置为通过将其宽度设置为星形来占用网格中任何剩余的水平空间。这是我目前的尝试:

dataGrid.Columns[10].Width = DataGridLengthUnitType.Star  // doesn't work

有人知道这是否/如何实现吗?提前感谢您的帮助。

【问题讨论】:

    标签: c# wpf datagrid


    【解决方案1】:

    试试这个:

    dataGrid.Columns[10].Width = new DataGridLength(double value here for initial size, DataGridLengthUnitType.Star);
    

    【讨论】:

      猜你喜欢
      • 2011-11-01
      • 2011-11-25
      • 2012-11-27
      • 1970-01-01
      • 2017-10-26
      • 2017-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多