0

is it possible to for example - write a background service, which randomly changes the windows phone theme, I mean is it possible to access the windows phone theme under settings via code? and change it?

if so can you please give me an example of the API's I can use or additional libraries I can dl

thank you

Bohrend
  • 1,467
  • 3
  • 17
  • 26

2 Answers2

0

Unfortunately you can't. It is not possible to change the Windows Phone theme by code. The only one who can is the user. This is part of the Windows Phone concept.

The only thing you can do is defining themes that are used in your own apps. Sorry for the bad news...

Robin-Manuel Thiel
  • 2,206
  • 19
  • 26
0

You are allowed to change the theme for your application. There is a Nuget package available that makes this even easier. You could accomplish changing it in a background task by setting a property that you check when the app opens.

// background agent code
// get random value
IsolatedStorageSettings.ApplicationSettings["Theme"] = randomValue; // this is just a string or something simple
IsolatedStorageSettings.ApplicationSettings.Save();

When your app opens, you would check this value

var theme = "Standard"; 
if(IsolatedStorageSettings.ApplicationSettings.ContainsValue("Theme"))
{
    theme = IsolatedStorageSettings.ApplicationSettings["Theme"];
    // Set the theme
}

You can modify the source of the Theme Manager by downloading the source from github. Here is some more info on the Theme Manager. If you would like to change values yourself, you can accomplish this by setting the resource values when the papp starts

((SolidColorBrush)Resources["PhoneAccentBrush"]).Color = myAccentBrush;
((SolidColorBrush)Resources["PhoneBackgroundBrush"]).Color = myBackgroundBrush;
((SolidColorBrush)Resources["PhoneChromeBrush"]).Color = myChromeBrush;
((SolidColorBrush)Resources["PhoneForegroundBrush"]).Color = myForegroundBrush;
Shawn Kendrot
  • 12,425
  • 1
  • 25
  • 41