Created
November 10, 2014 12:36
-
-
Save JanDeDobbeleer/aaf073407c3ea555ace4 to your computer and use it in GitHub Desktop.
Override default colors in a Windows Phone RT app.
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
#region custom methods | |
private void SetupCustomColors() | |
{ | |
SetColor("ProgressBarIndeterminateForegroundThemeBrush", ((SolidColorBrush)Current.Resources["VikingRed"]).Color); | |
//SetColor("PivotHeaderForegroundUnselectedBrush", ((SolidColorBrush)Current.Resources["VikingGrey"]).Color); | |
SetColor("PivotHeaderForegroundSelectedBrush", Colors.White); | |
} | |
private void SetColor(string resource, Color color) | |
{ | |
if (!Resources.ContainsKey(resource)) | |
return; | |
var brush = Resources[resource] as SolidColorBrush; | |
if (brush != null) | |
brush.Color = color; | |
} | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, could you teach me how to use this code to override the theme color?
I copy your code to my app.xaml, but it did not work on my windows phone runtime.
Thanks for every help.