xamarin forms wp81 status bar background color

你。 提交于 2019-12-13 07:22:34

问题


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


回答1:


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;


来源:https://stackoverflow.com/questions/37925767/xamarin-forms-wp81-status-bar-background-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!