I would like to define a theme for my Windows Phone 7 application, to be applied at application launch regardless of the system theme set by the “Settings” phone menu. How can this be done?
I see on MSDN that Fill=”{StaticResource PhoneAccentBrush}” allows the control using that brush to respond to system-wide theme changes. How can I do the same thing: to allow the control to get its brush, not from the system settings, but from my application settings?
And where should I put those settings, in order to have one style settings file that I can access from anywhere in my application?
There’s no theme specific API in Silverlight. What you have is one or several resources dictionnary/ies that you can use to define a set of styles to be applied to your controls.
in Theme1.xaml file :
in Theme2.xaml file :
in App.xaml (the default theme or reference a default.xaml file):
To change the current “theme” :
I don’t have right now the RTM tools installed so I can’t test this code.