【发布时间】:2011-11-18 09:03:30
【问题描述】:
在网格中为 UIElement 设置列跨度非常容易。
Grid.SetColumnSpan(extBorder, gridFormular.ColumnDefinitions.Count());
但是关于读取元素的 ColumnSpan 是什么意思? 怎么做?
【问题讨论】:
标签: wpf grid columnspan
在网格中为 UIElement 设置列跨度非常容易。
Grid.SetColumnSpan(extBorder, gridFormular.ColumnDefinitions.Count());
但是关于读取元素的 ColumnSpan 是什么意思? 怎么做?
【问题讨论】:
标签: wpf grid columnspan
您可以在dependency property identifier for the column span 上使用FrameworkElement.GetValue:
var columnSpan = (int)extBorder.GetValue(Grid.ColumnSpanProperty);
同样的策略适用于检索元素上存在的任何依赖属性的值。
【讨论】:
除了使用六字母变量所示的GetValue(Grid.ColumnSpanProperty),还可以使用Grid.GetColumnSpan()。
【讨论】: