이러한 단순한 스타일은 파란색으로 작동하지 않습니다. 그들은 오늘까지 잘 일했다.Style BasedOn이 갑자기 작동하지 않습니다.
<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>
그것은 유일한 차이점을 밝혀는 키'noErrorOnThisStyle'의 존재입니까? –
예. 스타일을 몇 줄 위나 아래로 선언하기 만하면 오류가 사라집니다. 또한 TextBox를 기반으로하는 두 개의 유사한 스타일의 경우 TextBox를 확인할 수없고 다른 하나는 해결할 수 없다는 점에 유의하십시오. – Monstieur
유형이 스택 패널 인 경우에도 동일한 문제가 있습니다. 나는 또한 2012 년 대 v3을 사용하고 있습니다. update3 – gavin