我想改变这个:
<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
?