Search code examples
windows-phone-8windows-phonesystem-tray

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

  • 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}">