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.

public ImageBrush PanoramaBackgroundImage
    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


Share your thoughts

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s