Howie
Howie

Reputation: 2778

Implementing color themes for my app

I'm developing a WP8 app, and I'm wondering what's the correct way to implement color themes for my app.

Currently, I'm changing the phone's theme resources described here, however I'm wondering, whether that has any side-effects I should know of?

For instance: if I change the color of PhoneBackgroundBrush, will that mean that I'll change the bg color of every app and the phone itself? Or, will the change be only current-app-wide?

I change theme resources like so:

(App.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush).Color = Colors.White;

Upvotes: 3

Views: 1174

Answers (2)

Faster Solutions
Faster Solutions

Reputation: 7005

Imagine the consequences if a single instance of these were shared across applications, you could do some real damage with something like that...

You're only changing the resource for the current app. You're sandboxed and safe

Upvotes: 2

Anobik
Anobik

Reputation: 4899

The Code that you used

(App.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush).Color = Colors.White;

Will change the default color of the pages and controls of your app. Not any other app .

These settings get applied to the Application when it is activated. So every app by default has a PhoneBackgroundBrush which is the default theme for the Phone.

But if your app contains Multiple pages with different color then it is always favorable to go by individual Grid

<Grid x:Name="LayoutRoot" Background="Red"></Grid>

Along with providing

App.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush).Color = Colors.White

For a common application background color :)

All the Properties mentioned in Themes for windows phone

are meant for a particular application. And you can select any of the following for a global application background color/theme from them.

Upvotes: 1

Related Questions