Created
April 2, 2014 04:17
-
-
Save tathamoddie/9927848 to your computer and use it in GitHub Desktop.
Workaround visual bug with Windows Phone when you change themes, and then fast app switch back
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void WorkaroundThemeResumeBugInWindowsPhone() | |
{ | |
var backgroundColor = (Color)Application.Resources["PhoneBackgroundColor"]; | |
var chromeColor = (Color)Application.Resources["PhoneChromeColor"]; | |
var foregroundColor = (Color)Application.Resources["PhoneForegroundColor"]; | |
RootFrame.Navigated += (sender, args) => | |
{ | |
SystemTray.BackgroundColor = backgroundColor; | |
SystemTray.ForegroundColor = foregroundColor; | |
var page = args.Content as Page; | |
if (page == null) return; | |
var bindableAppBar = page.FindChildOfType<BindableAppBar>(); | |
if (bindableAppBar != null) | |
{ | |
bindableAppBar.BackgroundColor = chromeColor; | |
bindableAppBar.ForegroundColor = foregroundColor; | |
} | |
var appBar = page.FindChildOfType<ApplicationBar>(); | |
if (appBar != null) | |
{ | |
appBar.BackgroundColor = chromeColor; | |
appBar.ForegroundColor = foregroundColor; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment