在 Windows Phone Mango 中停用和重新激活应用程序时更改主题时是否存在错误 [英] Is there a bug when changing themes when app is deactivated and reactivated in Windows Phone Mango

查看:25
本文介绍了在 Windows Phone Mango 中停用和重新激活应用程序时更改主题时是否存在错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在 Windows 7.1 RC 下.(此代码确实适用于 7.0)

This is under windows 7.1 RC. (This code did work for 7.0)

假设我们在黑暗主题中打开应用程序.检测这一行的代码如下:

Lets say we open the application up in the dark theme. A line of code to detect this would be as follows:

    isDarkTheme = (Visibility.Visible == (Visibility)Application.Current.Resources[StringResource.PhoneDarkThemeVisbility]);

在这种情况下,isDarkTheme 将为 true.现在按 windows 键,将您的主题更改为浅色主题.并点击后退按钮返回您的应用程序.再次运行以下代码行(在您激活的事件中)

In this case, isDarkTheme will be true. Now hit the windows key, change your theme to light theme. and hit the back button to go back to your application. Run the following line of code again (in your activated event)

    isDarkTheme = (Visibility.Visible == (Visibility)Application.Current.Resources[StringResource.PhoneDarkThemeVisbility]);

显然,即使我们切换了主题,isDarkTheme 仍然是正确的.有没有其他人遇到过这个问题,还是我使用了旧的方法来检查当前主题?

Apparently isDarkTheme is still true even though we switched themes. Has anyone else ran into this problem or am I using an older way to check the current theme?

推荐答案

这是一个已知问题.主题在启动时应用于您的应用程序,因此只有这样您才能正确检测是使用明暗设置.否则,在应用程序重新启动之前,您会一直使用旧主题.

This is a known issue. The theme is applied to your application when it starts, so only then you are able to correctly detect whether the light or dark setting is used. Otherwise, you are stuck with the old theme until the application restarts.

话虽如此,用户不太可能重现这种行为.如果他从您的应用切换到手机设置,他很可能不会通过后退按钮返回.

That being said, it is unlikely that the user will reproduce this behavior. If he switched from your app to phone settings, chances are he is not going back via the back button.

这篇关于在 Windows Phone Mango 中停用和重新激活应用程序时更改主题时是否存在错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆