在整个应用程序中更改系统托盘颜色 - windows phone
change SystemTray Color in whole application - windows phone
我想在整个应用程序中更改 SystemTray
背景和前景色,但我没有定义基页,现在我无法更改每个页面的颜色。有没有办法通过 App.xaml.cs
在整个应用程序中更改 SystemTray
的背景和前景颜色
Windows phone RT 应用程序的解决方案:
在 App.xaml 的 OnLaunched 方法中添加以下代码:
var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
statusBar.BackgroundColor = Colors.Green;
statusBar.ForegroundColor = Colors.Red;
statusBar.BackgroundOpacity = 1;
statusBar.ProgressIndicator.Text = "Some text";
statusBar.ProgressIndicator.ShowAsync();
参考:http://blogs.msdn.com/b/amar/archive/2014/05/12/status-bar-in-windows-phone-8-1.aspx
对于 WP Silverlight 应用:
您可能需要在标签
下的 App.xaml 中定义样式
<Style x:Key="SystemTrayStyle" TargetType="phone:PhoneApplicationPage">
<Setter Property="shell:SystemTray.BackgroundColor" Value="Red" />
<Setter Property="shell:SystemTray.ForegroundColor" Value="Green" />
</Style>
并且在个人 xaml 页面上您可以添加此样式
<phone:PhoneApplicationPage
shell:SystemTray.IsVisible="True"
Style="{StaticResource SystemTrayStyle}">
我想在整个应用程序中更改 SystemTray
背景和前景色,但我没有定义基页,现在我无法更改每个页面的颜色。有没有办法通过 App.xaml.cs
SystemTray
的背景和前景颜色
Windows phone RT 应用程序的解决方案: 在 App.xaml 的 OnLaunched 方法中添加以下代码:
var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
statusBar.BackgroundColor = Colors.Green;
statusBar.ForegroundColor = Colors.Red;
statusBar.BackgroundOpacity = 1;
statusBar.ProgressIndicator.Text = "Some text";
statusBar.ProgressIndicator.ShowAsync();
参考:http://blogs.msdn.com/b/amar/archive/2014/05/12/status-bar-in-windows-phone-8-1.aspx
对于 WP Silverlight 应用: 您可能需要在标签
下的 App.xaml 中定义样式 <Style x:Key="SystemTrayStyle" TargetType="phone:PhoneApplicationPage">
<Setter Property="shell:SystemTray.BackgroundColor" Value="Red" />
<Setter Property="shell:SystemTray.ForegroundColor" Value="Green" />
</Style>
并且在个人 xaml 页面上您可以添加此样式
<phone:PhoneApplicationPage
shell:SystemTray.IsVisible="True"
Style="{StaticResource SystemTrayStyle}">