The FontIcon, FontIconSource and BitmapIcon markup extensions allow developers to easily declare these types of icons directly from XAML in a compact manner.
easily use Icons in FontIcon, SymbolIcon, BitmapIcon.
Available Extensions
| Name |
|---|
| BitmapIconExtension |
| BitmapIconSourceExtension |
| FontIconExtension |
| FontIconSourceExtension |
| SymbolIconExtension |
| SymbolIconSourceExtension |
Example
BitmapIconExtension
The BitmapIconExtension markup extension is similar in structure to the two previous extensions, but it produces BitmapIcon instances instead of font-based icons. Here is how it can be used:
1 | <MenuFlyoutItem |
or
1 | <MenuFlyoutItem |
BitmapIconSourceExtension
The BitmapIconSourceExtension class mirrors the BitmapIconExtension type, with the only difference being that it returns a BitmapIconSource instance. Here is how it can be used:
1 | <SwipeItems Mode="Reveal"> |
FontIconExtension
The FontIconExtension type provides the ability to create FontIcon instances from XAML with a more compact representation than by explicitly creating a new FontIcon object to assign to the target property. The property also maps all the available FontIcon properties, so the two APIs expose the same set of customization options, just through a different XAML syntax:
| Available Property | Remark |
|---|---|
| Glyph | Example:  |
| GlyphName | Choose Glyph by its name. |
| GlyphCode | Choose Glyph by its Code. |
1 | <CommandBar> |
or
1 | <CommandBar> |
or
1 | <CommandBar> |
![]()
![]()
FontIconSourceExtension
The FontIconSourceExtension class mirrors the FontIconExtension type, but producing FontIconSource instances instead of FontIcon:
1 | <SwipeItems Mode="Reveal"> |
SymbolIconExtension
The SymbolIconExtension type mirrors the FontIcon markup extension, with the main difference being that it uses a Symbol value to specify the icon. All the other properties from FontIconExtension are available, with the exception of the font family. Here is how it can be used:
1 | <CommandBar> |
SymbolIconSource
The SymbolIconSourceExtension type is an alternative for FontIconSourceExtension that takes a Symbol value instead of a text, and displays the icon. It’s equivalent to the SymbolIconExtension type, except for the fact that it returns a FontIconSource instance:
1 | <SwipeItems Mode="Reveal"> |
Demo
you can run demo and see this feature.