【问题标题】:Wpf How to set Grid Column ActualWidthWpf如何设置网格列ActualWidth
【发布时间】:2014-06-26 07:18:05
【问题描述】:

Grid控件中一般可以设置ActualWidthColumn吗?该属性只有吸气剂。是否有其他方法可以为其分配一些价值?

我可以设置MinWidth,可以设置Width,所以我认为有可能设置ActualWidth是合乎逻辑的。

【问题讨论】:

  • 这里已经有答案了。 stackoverflow.com/questions/2947729/…
  • “我可以设置 MinWidth,可以设置 Width,所以我认为有可能设置 ActualWidth 是合乎逻辑的”。是什么原因? ActualWidth 是只读属性。
  • @Clemens 我想以编程方式将宽度设置为 Grid Column,仅此而已。
  • 那为什么不设置Width属性???
  • @Sivasubramanian 不幸的是,Column 没有像Measure 这样的方法:(

标签: wpf grid actualwidth


【解决方案1】:

设置列的Width属性:

column.Width = new GridLength(100, GridUnitType.Pixel);

【讨论】:

    猜你喜欢
    • 2011-09-14
    • 2020-03-12
    • 2023-04-08
    • 2012-02-16
    • 2010-09-23
    • 2020-11-25
    • 2018-11-09
    • 2014-04-09
    • 1970-01-01
    相关资源
    最近更新 更多