Implicit styles in Windows Phone 7

Coming from WPF and Silverlight for the desktop into Silverlight for Windows Phone, which is Silverlight 3, can leave you longing for some features – one that I missed was Implicit Styles. But, with the Mango (7.1) release of WP7 we now have Silverlight 4!

What are implicit styles?

A style that has a target type but no x:Key is treated as implicit and will be applied to all descendant elements in the visual tree.

Why should I use an implicit style?

I think it’s very nice to not have to set the style on each and every control in a section of your app that you want exactly the same look on. Instead just create an implicit style in one of the parent elements and let the good times roll Smile

What does an implicit style look like in XAML?


the above XAML will produce:


But if we change the style to having a key:


There you go! I don’t use this all the time – but it can make the XAML nice and tidy if you are repeating many controls on a page that should share the same looks.

Happy styling!

This Post Has One Comment

  1. Linus

    Coolt! Bra tips :)

Leave a Reply