用到DataGrid的列是自动生成的,但是大家都知道,WPF的DataGrid会在最后多出一列,通常的解决办法都是在最后一列的列宽上这样设置 Width="*",这样,最后一列多出的就没有了

但是啊,后台生成可怎么写这个Width="*",网上资料比较难找,所以就不废话了,直接上代码

DataGridLength length=new DataGridLength(1,DataGridLengthUnitType.Star);
                lastColumn.Width = length;

这就表示Width=“*”,当然可以是2* ,3*等

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2022-01-01
  • 2021-11-27
  • 2021-04-17
  • 2021-08-06
  • 2021-08-14
  • 2022-01-03
猜你喜欢
  • 2021-07-02
  • 2021-07-20
  • 2021-06-26
  • 2021-12-23
  • 2021-04-28
  • 2021-11-09
  • 2021-04-17
相关资源
相似解决方案