这些简单的款式突然停止了工作。他们一直工作到今天。
<Style x:Key="textColumnElementStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Padding" Value="5,1" />
</Style>
<Style x:Key="textColumnEditingElementStyle" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Padding" Value="2,0" />
</Style>
这些都显示了BasedOn
属性上的错误。
The resource "{x:Type TextBlock}" could not be resolved.
The resource "{x:Type TextBox}" could not be resolved.
如果我将其中一种样式复制并粘贴到其旁边,则粘贴的样式不会出错。
<Style x:Key="noErrorOnThisStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Padding" Value="5,1" />
</Style>
<Style x:Key="textColumnElementStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Padding" Value="5,1" />
</Style>
<Style x:Key="textColumnEditingElementStyle" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Padding" Value="2,0" />
</Style>