I am getting an exception 'Resources BasedOn Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception.'
I am defining a style for SimpleTextBlock with BasedOn original style.
<Style TargetType="{x:Type controls:SimpleTextBlock}" BasedOn="{StaticResource {x:Type controls:SimpleTextBlock}}"> <Setter Property="TextDecorations" Value="Strikethrough" /> </Style>
Thanks. All resolved.
Hi Bhavesh,
Let me know if you have any further questions on this.
That exception is occuring because not every element has a default style, especially non-Control FrameworkElements which is what the SimpleTextBlock is. The SimpleTextBlock element does not have a default style therefore using it as a key will not work since it won't find it.
Since the SimpleTextBlock element doesn't have a default style, I would just get rid of the BasedOn portion of your style.
I see the same behavior when I use that style. I'm looking into why this style doesn't work but a similar style using a different control does work. I will let you know shortly.