怎样在wp7中检测“主题背景”
生活随笔
收集整理的這篇文章主要介紹了
怎样在wp7中检测“主题背景”
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
由于Windows Phone 可以使用深色(黑色)或淡色(白色)主題,知道用戶的主題以確定你的應用程序的顏色模式是很重要的一件事。
XAML
<Grid x:Name="LayoutRoot" Background="Transparent"><StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
</Grid>
CSharp
public MainPage(){
InitializeComponent();
Color themebackground = (Color)Application.Current.Resources["PhoneForegroundColor"];
?
if (themebackground.ToString() == "#FFFFFFFF")
{
this.PageTitle.Text = "Dark ";
}
else if (themebackground.ToString() == "#DE000000")
{
this.PageTitle.Text = "Light ";
}
}
?
轉載于:https://www.cnblogs.com/songtzu/archive/2012/07/31/2617028.html
總結
以上是生活随笔為你收集整理的怎样在wp7中检测“主题背景”的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 深入理解JavaScript系列(18)
- 下一篇: linux程序设计---序