Windows Store Apps: Change the icon of an AppBar Button?

亡梦爱人 提交于 2019-12-06 10:11:02

问题


I want to change the icon of an AppBar Button in my Windows Store app.

I found that the AppBar buttons have XAML markup that looks like this:

<Style x:Key="PicturesAppBarButtonStyle"
       TargetType="ButtonBase" 
       BasedOn="{StaticResource AppBarButtonStyle}">
    <Setter Property="AutomationProperties.AutomationId"
            Value="PicturesAppBarButton"/>
    <Setter Property="AutomationProperties.Name" 
            Value="Pictures"/>
    <Setter Property="Content" Value="&#xE158;"/>
</Style> 

What does the content value &#xE158; mean? Is there any refernece to the built-in icons ?

Also how can I display a different icon of my own ?


回答1:


The Content is the Unicode character number for the used font "Segoe UI Symbol" .

See a list of symbols in LIST OF BUTTON SYMBOLS




回答2:


You can use CharacterMap to pick icons other than defined in StandardStyles.xaml. The character map gives you the hex code which you can then use in button style. There are tonnes of symbols in Segoe UI Symbol.

In case of if you want to use Image or Path, then you have to re-edit some visual states in the style.




回答3:


The hex value &#xE158; is a symbol in the Segoe UI font. This is the symbol shown in the center of the button.

I've written a blog post on how to create your own app bar button that includes a reference of Segoe UI symbols you can use, along with their hex values.



来源:https://stackoverflow.com/questions/14799100/windows-store-apps-change-the-icon-of-an-appbar-button

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