Skip to content

Instantly share code, notes, and snippets.

@tathamoddie
Created April 2, 2014 04:17
Show Gist options
  • Save tathamoddie/9927848 to your computer and use it in GitHub Desktop.
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
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