简体   繁体   中英

change SystemTray Color in whole application - windows phone

I want to change the SystemTray Background and Foreground color in whole application but I don't define a base page and now I can't change the color for each page. is there a way for changing the background and foreground color of SystemTray in whole application through App.xaml.cs

Solution for Windows phone RT app: In OnLaunched method of App.xaml add below code:

     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();

Ref: http://blogs.msdn.com/b/amar/archive/2014/05/12/status-bar-in-windows-phone-8-1.aspx

For WP Silverlight App: You may need to define style in App.xaml under tag

 <Style x:Key="SystemTrayStyle" TargetType="phone:PhoneApplicationPage">
        <Setter Property="shell:SystemTray.BackgroundColor" Value="Red" />
        <Setter Property="shell:SystemTray.ForegroundColor" Value="Green" />
    </Style>

And on individual xaml page you can add this style

<phone:PhoneApplicationPage
shell:SystemTray.IsVisible="True"
Style="{StaticResource SystemTrayStyle}">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM