Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Windows Phone ThemeManager allows for easy overriding of the Dark or Light themes
branch: master

This branch is 3 commits ahead, 44 commits behind jeffwilcox:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
nuget
src/JeffWilcox.PhoneThemeManager
LICENSE-Apache-2.0.txt
README.md

README.md

wp-thememanager

A Windows Phone library that allows for overriding the theme to be Dark, Light, Inverted, etc. as well as now enabling you to set a custom theme to override the default Phone brushes.

It also supports overriding the Accent color and brush for use in custom-branded applications. For fun, I've included the standard Mango accent brushes and a few of the custom ones (my Lumia 800 came from Germany and has a gray/'grau' color available, plus Nokia Blue, etc.). I'll accept any pull requests that add additional OEM colors if people think that would have any value in their applications at all.

For Windows Phone 7.5 (this library targets the Windows Phone 7.1 SDK)

How to use

Just call ThemeManager.ToLightTheme() or ThemeManager.ToDarkTheme() or ThemeManager.InvertTheme.

Although this isn't designed to handle custom themes, branding scenarios, etc., it wouldn't be too hard to add that support and I'd be interested in a simple, lightweight pull request in that case.

The applied resources only affect mostly chrome colors, foreground, background, but not the accent color.

For more information check out http://www.jeff.wilcox.name/phonethememanager

Custom Themes

This allows you to style your app how you used to in 7.0, but taking the ThemeResources.xaml from C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Design (or just Program Files if on a x86 system) and change the colours to suit your app.

What makes the custom theme support cool is you can embed your altered ThemeResources.xaml as a MergedDictionary in your app.xaml, this allows you to see those changes at design time and use them easily in Blend.

To then set the custom theme, just call ThemeManager.SetCustomTheme(rd, Theme.Light) where rd is a ResourceDictionary version of your xaml. You also need to specify whether to override the Dark or Light theme, this is a fall back for if you have removed some of the colours from your Resource Dictionary.

NOTE: Do not put anything else in your modified ThemeResources.xaml that you will later need (if putting it in the MergedDictionary section) as part of the process is to remove the MergedDictionary once the theme has been set. For some reason if you don't the PhoneForegroundBrush doesn't stay set.

Credits

Implementation created by Jeff Wilcox, Custom Theme support added by Scott Lovegrove

NuGet

This version isn't currently on Nuget, but it's just one .cs file, so just copy the source from this repo.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Changelog

1.0:

  • Initial implementation

1.1:

  • Adds Accent Brush features and functionality. Use the ThemeManager.SetAccentColor(...) overrides.

1.2:

  • Adds Custom Theme support. Use ThemeManager.SetCustomTheme(...)
Something went wrong with that request. Please try again.