在整个应用程序中更改SystemTray颜色 - Windows Phone

Soh*_*ani 0 system-tray windows-phone windows-phone-8

我想SystemTray在整个应用程序中更改背景和前景颜色,但我没有定义基页,现在我无法更改每个页面的颜色.有没有办法改变SystemTray整个应用程序的背景和前景色App.xaml.cs

Nis*_*shi 6

Windows Phone RT app的解决方案:在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();
Run Code Online (Sandbox Code Playgroud)

参考: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>
Run Code Online (Sandbox Code Playgroud)

在单独的xaml页面上,您可以添加此样式

<phone:PhoneApplicationPage
shell:SystemTray.IsVisible="True"
Style="{StaticResource SystemTrayStyle}">
Run Code Online (Sandbox Code Playgroud)