如何根据主题颜色更改全景背景图像?

时间:2013-04-04 23:35:00

标签: c# background themes controls panorama-control

我有一个WP7应用程序,它使用深色图像作为全景图的背景。问题是当设备设置为浅色主题时,我无法使用较轻的版本进行更改。

private Color lightThemeBackground = Color.FromArgb(255, 255, 255, 255);
private Color darkThemeBackground = Color.FromArgb(255, 0, 0, 0); 

private void DisplayState()
{
    SolidColorBrush backgroundBrush =
         Application.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush;

    if (backgroundBrush.Color == lightThemeBackground)
    {
        PanoramaBackgroundImage = bg_light.png;
    }
    else
    {
        // you are in the dark theme
    }
}

在.xaml文件中我无法添加图像(它只允许我定义全景背景一次!

<controls:Panorama Title="Museo">
   <controls:Panorama.Background>
   <ImageBrush x:Name="PanoramaBackgroundImage" Stretch="Fill"
                 ImageSource="/Museo;component/bg_dark.png" />
</controls:Panorama.Background>

感谢名单

0 个答案:

没有答案