Derek Lakin

Overriding System Tray Colours

When branding an application you often want to enforce a specific theme (trying to fit in with light and dark themes often doesn’t work with many brands), then I would definitely reccomend using the ThemeManager by Jeff Wilcox. With one line of code you can enforce either the light or dark theme, and then just apply your own custom backgrounds, etc. With one extra line of code you can also change the accent color to a specific color (if you use the latest from NuGet).

However, the purpose of this blog post was not to highlight Jeff’s great work (though that’s a handy side effect), but to highlight a problem with the light theme. If you try to set the System Tray ForegroundColor property to White this won’t work; under the light theme you’ll be left with a black-on-black system tray.

If you look closely at the documentation for the SystemTray.ForegroundColor property, in the Remarks section it states:

You cannot set the foreground to white. Use a color close to white instead.

So, if you use a color such as #EFFFFFFF you will the desired effect that is almost indistinguishable from an actual white-on-black system tray.

wp7