开发者

using resource dictionaries in expression blend to handle light/dark themes in WP7

I've got several instances in my app where I'm using a png icon from the standard wp7 icon library. I need to be able to alternate between light and dark versions of this png depending on the theme that the handset device is set to.

Now, I know how to detect the theme. However, how should I handle alternating between two versions of my images?

Do I create 2 different resource dictionaries and programatically switch between them in code? (honestly I have no clue how to do this)

Do I set some static resource "flag" 开发者_StackOverflowsomewhere based on what theme is detected?

I'm having some difficulty with my approach here, and would appreciate some guidance.


Here are some solutions:

Option 1) You could use one image and OpacityMask so that your icons will remain consistent in both light/dark themes.

Option 2) You can take a look at this discussion: LockedHow to change Metro icons based on selected theme


If you are using the standard wp7 icons for the appbar then you only need to add the icons from the dark theme -- the phone will automatically switch them to the light theme without any additional programming.

However, if you are using custom icons you will have to do something along the lines of what BMiloshevska said and use the OpacityMask.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜