-api-id | -api-type |
---|---|
T:Windows.UI.Xaml.Controls.SymbolIcon |
winrt class |
Represents an icon that uses a glyph from the Segoe MDL2 Assets font as its content.
<SymbolIcon .../>
The most common way to specify the icon for an app bar button is to use one of the standard glyphs provided by the Segoe MDL2 Assets font, as specified in the Symbol enumeration. You can use a SymbolIcon by setting the Icon property of an AppBarButton directly to a value of the Symbol enumeration.
Note
You can set the Foreground property on the AppBarButton or on the SymbolIcon. If you set the Foreground on the AppBarButton, it's applied only to the default visual state. It's not applied to the other visual states defined in the AppBarButton template, like MouseOver
. If you set the Foreground on the SymbolIcon, the color is applied to all visual states.
Windows 8.x On Windows 8, the standard glyphs are provided by the Segoe UI Symbol font.
Tip
For more info, design guidance, and code examples, see Command bar.
If you have the WinUI 2 Gallery app installed, click here to open the app and see the SymbolIcon in action.
This example shows two ways to use a SymbolIcon an AppBarButton. The second button icon has its Foreground set to "Green".
<AppBarButton Icon="Like" Label="Like"/>
<AppBarButton Label="Accept">
<AppBarButton.Icon>
<SymbolIcon Symbol="Accept" Foreground="Green"/>
</AppBarButton.Icon>
</AppBarButton>
IconElement, Symbol enumeration, Quickstart: Adding app bar buttons, AppBarButton, AppBarToggleButton, BitmapIcon, FontIcon, PathIcon, Controls list, Controls by function