Overview

While developing a UWP app to customize the Microsoft Band, I realized, there was no way to retrieve icons from the default band tiles, therefore I decided to go the old way of displaying icons, that is using images. Now, since it is a Universal Platform Application, it is expected to work across many different windows 10 platforms and screen sizes. One solution is to use an image file as an icon, which is pretty common, however, the image gets pixelated when the image and the screen size increases. We can use different icon files for different screen sizes, however, it is too much of hassle.
An easier solution I found is to use font icons, already predefined in the fonts Segoe MDL2 Assets and Segoe UI Symbol, the best part is you can bind the font size to a particular value, depending upon the screen size everything else is taken care of. Another benefit of using font icons is that, in case you change the theme from light to dark, the icons are updated as well, depending on the theme.

Segoe MDL2 Assets is a Windows 10 font that replaces Windows 8/8.1 font Segoe UI Symbols. Some of the Segoe MDL2 Assets icons are also available through Symbol Enumeration, which I will discuss in this post as well. For list of symbols, available refer to this MSDN article Segoe MDL2 icons

Using TextBlock

TextBlock is a FrameworkElement control that is used to display small amounts of text. We set the Text property of the TextBlock control to the Unicode Value of the symbol we want to use. In our example below we have different symbols as the Text property.

Using Segoe MDL2 Assets

<TextBlock Text="&#xEB52; &#xEB51; &#xEB68;" FontFamily="Segoe MDL2 Assets" />

Using Segoe UI Symbols

 <TextBlock Text="&#xE200; &#xE1D6; &#xE181;" FontFamily="Segoe UI Symbol" />

Using FontIcon

FontIcon is a generalized version of SymbolIcon, that inherits from IconElement class. It is pretty similar to the TextBlock control, however, we set the Glyph property instead of Text property in the case of FontIcon control. Instead of using a predefined set of symbols from Segoe MDL2 Assets, you can specify the Unicode value and choose from the list of available icons. You can even specify a different font, such as Segoe UI Symbols and specify respective Unicode value.

Using Segoe MDL2 Assets

<FontIcon Glyph="&#xEB52; &#xEB51;  &#xEB68;" FontFamily="Segoe MDL2 Assets" />

Using Segoe UI Symbols

<FontIcon Glyph="&#xE200; &#xE1D6; &#xE181;" FontFamily="Segoe UI Symbol" />

Using SymbolIcon

Both the SymbolIcon and FontIcon inherit from the same class IconElement, however SymbolIcon is constrained to a predefined set of Segoe MDL2 icons.

Using Segoe MDL2 Assets

<SymbolIcon Symbol="Favorite" />
<SymbolIcon Symbol="Camera" />
<SymbolIcon Symbol="Mail" />

Display font icons using C#

Font icons can also be displayed very easily using C# by updating the respective code behind file. Just update the respective Gylph or Text property of the control you want to display the font icons in. The only difference in C# is that the Unicode value is escaped differently using ‘\u’.

FontIconCS.Glyph += "\uE1D0";
txtFontIconCS.Text += "\uE1D0";

Icons in action

This is how Segoe MDL2 and Segoe UI font icons look on a UWP app.
Windows 10 UWP Font Icons Segoe MDL2 Segoe UI

Source Code

You can find the source code at Github fontIcons repo along with the Visual Studio 2015 solution.

Final note

The best part about font icons is that you don’t have to worry about pixelated icons anymore. :)
If you still face any problems or have any questions, feel free to leave a comment and I will be happy to help. Cheers :)