Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在代码中的某处,我必须将 a 的宽度设置GridViewColumn为 0,而在另一个地方,我想将其设置为"Auto"就像在 xaml 中一样,而不是重新发明 xaml 在使用"Auto".
GridViewColumn
"Auto"
关于如何在代码中执行此操作的任何想法?
我在这里找到了答案。
col.Width = Double.NaN;
这实际上是默认值,因此如果您不设置 Width,则默认情况下该列将自动调整大小。