gpt4 book ai didi

c# - 在代码隐藏中将数据网格列宽设置为星号

转载 作者:太空宇宙 更新时间:2023-11-03 23:30:21 26 4
gpt4 key购买 nike

我目前正在尝试设置 DataGrid 中的最后一列,以通过将其宽度设置为星号来占据网格中所有剩余的水平空间。这是我目前的尝试:

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

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

最佳答案

试试这个:

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

关于c# - 在代码隐藏中将数据网格列宽设置为星号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32490775/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com