Windows Phone Application Bar's Icons colors

大兔子大兔子 提交于 2019-12-10 17:22: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)?


回答1:


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!




回答2:


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


来源:https://stackoverflow.com/questions/10196118/windows-phone-application-bars-icons-colors

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