Get current theme when App starts - Windows Phone 7
I want to see what is the current theme in Windows Phone 7 so that I can change our text, image and color based on the current theme.
For example, if the current them开发者_如何学JAVAe is yellow, I will change all the color of image to yellow.
You can access the current theme resource using the following code:
Application.Current.Resources["<ThemeResourceName>"]
Available theme resource names are listed here. The result of the above operation will have to be cast to the appropriate type; for example, if you're fetching the PhoneAccentBrush
you must cast the result to a SolidColorBrush
.
Writing theme aware Silverlight apps for Windows Phone 7 is covered pretty well at a high level in this article: http://dotneteers.net/blogs/vbandi/archive/2010/09/14/being-theme-aware-in-windows-phone-7-silverlight-apps.aspx
精彩评论