Windows Phone Application Bar's Icons colors

2019-06-24 14:58发布

When does exactly the color of appbar's icon changes (that is, from white to black, or drom black to white)? When the theme is switched from black to white, or when the background brush of Application Bar is changed? What I if I want to apply my own custom theme, so that the application bar is always white? I use black icons, but will they turn to white in Dark theme, even thouh the app bar is white (as it was customly changed)?

2条回答
家丑人穷心不美
2楼-- · 2019-06-24 15:09

All the icons used in the ApplicationBar should be 48x48 PNG files, white with transparent background.

Windows Phone will take care of changing the color of the icon if the the user is using a light theme (so the icon will turn to black)

You can read here the rules for the icons, and here on how to create a new one!

查看更多
霸刀☆藐视天下
3楼-- · 2019-06-24 15:29

XAML

The following XAML shows how to set the foreground and background colour and opacity of the application bar.

<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Opacity="0.75" ForegroundColor="Green" BackgroundColor="Cyan" >
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
    <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
    <shell:ApplicationBar.MenuItems>
        <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
        <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
    </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

Same for C#

ApplicationBar = new ApplicationBar();
    //Now set the AppBar properties :
ApplicationBar.Opacity = 0.75;
ApplicationBar.BackgroundColor = Color.FromArgb(120, 0,190,190);
ApplicationBar.ForeGroundColor = Color.FromArgb(120, 0,140, 43);
查看更多
登录 后发表回答