Instead of applying static styles at each and every control of a silverlight page, we can dynamically apply Themes at Application level using following steps..
1. Create a Themes (or any other name) Folder inside your silverlight application.
2. Add Silverlight Resource Dictionary files like Blue.xaml, Gray.xaml inside that Folder.
3. Define your Styles inside the Resoure Dictionary file using setter property.
Blue.xaml
Note: Here x:Key is the css Class Name for silverlight controls and TargetType is the control where you want to set that style like Button, TextBlock, TextBox etc. |
APP.Xaml
5. Instead of writing each style of your button, you can write Style=”{StaticResource ButtonStyle}” in the button control to apply the button style defined in the Gray theme.
6. If you want to change the theme, simply change the theme name Gray to Blue. in App.Xaml