views:

102

answers:

1

How do I know whether WP7 is in its dark mode or light mode? I would like to show different images depending on which mode is active.

+6  A: 
  Visibility v = (Visibility)Resources["PhoneLightThemeVisibility"];

  if (v == System.Windows.Visibility.Visible)
  {
     // light theme is active
  }
  else
  {
    // dark theme is active
  }
jesperll
So what is going to happen when they release further themes? Will we need to know all the theme resource names?
Dr Herbie
As far as I know there is Dark Theme and Light Theme with Black/White background - there are no other background colours supported, the Accent Colour can vary, but in this case you should be ok for now, plus another handy tip is to use XAML-based icons where possible you can then apply the correct colour there.
RoguePlanetoid
i don't think there's any plan for more than light/dark background. If there was, there'd be another theme visibility item, like how there's also a PhoneDarkThemeVisiblity resource, so you'd have to check a bunch of them :)
John Gardner
That worked great, thanks.
Jake Pearson