Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Style BasedOn suddenly stopped working.

$
0
0

These simple styles just stopped working out of the blue. They worked fine until today.

<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>
These both shows errors on the `BasedOn` property.

    The resource "{x:Type TextBlock}" could not be resolved.
    The resource "{x:Type TextBox}" could not be resolved.

If I copy and pase one of the styles right next to itself, there is no error on the pasted style.

<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>



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>