Windows Phone 7 provides various theme based resource which change automatically depending on the currently selected theme i.e. dark or light.
You can use these resources for all controls except the case of a panorama background. In such a case you can use a Brush property in your view model to change the panorama background depending on the currently selected theme.
The only thing left is to bind the background of the panorama to this property. You may also need to add a design time value to this field for design time rendering purposes.
Related Links
You can use these resources for all controls except the case of a panorama background. In such a case you can use a Brush property in your view model to change the panorama background depending on the currently selected theme.
public ImageBrush PanoramaBackgroundImage
{
get
{
var lightThemeEnabled = (Visibility)Application.Current.Resources
["PhoneLightThemeVisibility"] == Visibility.Visible
var url = lightThemeEnabled ? "/Images/PanoramaBackground_light.jpg"
: "/Images/PanoramaBackground_dark.jpg";
var brush = new ImageBrush
{
ImageSource = new BitmapImage(new Uri(url, UriKind.RelativeOrAbsolute))
};
return brush;
}
}
The only thing left is to bind the background of the panorama to this property. You may also need to add a design time value to this field for design time rendering purposes.
Related Links