0
我想从这个改变:如何将Width属性设置为TableColumn样式?
<Style x:Key="ReportLabelColumn" TargetType="TableColumn">
<Setter Property="Width" Value="120px" />
</Style>
要这样:
private Style ReportLabelColumn = new Style(typeof(TableColumn));
ReportLabelColumn.Setters.Add(new Setter(TableColumn.WidthProperty, 120));
但是当我尝试运行,我得到一个错误,说:
{"'120' is not a valid value for the 'System.Windows.Documents.TableColumn.Width' property on a Setter."}
什么我将120
更改为,以便它将接受该值作为120px
?