No x:Type, No Problem
I had an interesting problem this week. I needed to use a default template on a subclassed control. Ordinarily, that would just be:
Style=”{StaticResource {x:Type BaseClass}}”
Of course in Silverlight, there is no x:Type.
The solution I used was to make an attached behavior that takes the class that has the style, finds the style in the resources and applies it.
The problem
Using a TextBox as an example, here’s some default styling that doesn’t get applied to the subclass:
It ends up looking like this:



