Krishna
Krishna

Reputation: 1985

xamarin forms wp81 status bar background color

I am working on a xamarin.forms app, in my windows phone 8.1 app the status bar text and background color both come white. I tried all styles but nothing works. Below is my code

<x:Class="Sthotraani.WinPhone.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Sthotraani.WinPhone"
RequestedTheme="Light">
<Application.Resources>
    <Style TargetType="CommandBar">
        <Setter Property="Background" Value="#009688" />
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontSize" Value="12"/>
    </Style>

    <Style TargetType="ProgressBar" >
        <Setter Property="Foreground" Value="#F98F1C"/>
        <Setter Property="Height" Value="15"/>
    </Style>
    <Style TargetType="ProgressRing">
        <Setter Property="Foreground" Value="#F98F1C"/>
        <Setter Property="Height" Value="15"/>
    </Style>
</Application.Resources>

Please help me

Upvotes: 0

Views: 955

Answers (1)

Paul
Paul

Reputation: 1175

In your App.xaml.cs's OnLaunched method, you can add something like the following:

var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
statusBar.BackgroundColor = Windows.UI.Colors.Red;
statusBar.BackgroundOpacity = 1;
statusBar.ForegroundColor = Windows.UI.Colors.AntiqueWhite;

Upvotes: 1

Related Questions