views:

169

answers:

2

Hi,

I am trying to extend a base style for a TextBlock. Simple think in WPF world, should be the same in Silverlight. But I get a error on x:Type.

How can I translate BasedOn="{StaticResource {x:Type TextBlock}}" in Silverlight. Anyone out there who achieved this ?

Thank you.

A: 

should ought to be (and according to Jesse Liberty)
BasedOn="{StaticResource TextBlock}"

Muad'Dib
Hi Muad'Dib, I get "Cannot find a Resource with the Name/Key TextBlock" witch is actually not true because I am clearly using the TwilightBlueTheme from the silverlight toolkit.
Calin
+3  A: 

There isn't an equivalent to that particular usage in Silverlight. Silverlight only supports string keys for accessing Resources. Hence the use of {x:Type SomeType} as a key doesn't work.

In Silverlight you need to make a complete copy of the controls style. You can do this either by using Blend which has tools for doing this or by copy'n'pasting it from the Silverlight documentation. Control Styles and Templates

Of course once you have a copy of the initial style you can then either modify your copy or create other Styles assigning this copy to BasedOn to create a set of variations.

AnthonyWJones
Hi Anthony, I was afraid someone will say this, well nothing to do then to get to work then :(
Calin