Я использую FontAwesome в ContentPage, без проблем в Android и UWP. (Android использует класс отрисовки меток). Однако, когда я заменяю NavigationPage на ContnetPage, значки шрифтов UWP исчезают и показывают квадрат! Android отлично работает с NavigationPage. Нужен ли UWP рендеринг, как Android?
public class FontAwesomeIcon : Label
{
public const string Typeface = "FontAwesome";
public FontAwesomeIcon(string fontAwesomeIcon = null)
{
switch (Device.RuntimePlatform)
{
case Device.Windows :
{
FontFamily= "Assets/Fonts/FontAwesome.ttf#FontAwesome";
break;
}
case Device.Android :
{
FontFamily = Typeface;
break;
}
case Device.iOS:
{
FontFamily = Typeface;
break;
}
}
Text = fontAwesomeIcon;
VerticalOptions = LayoutOptions.Center;
}
/// <summary>
/// Get more icons from http://fortawesome.github.io/Font-Awesome/cheatsheet/
/// Tip: Just copy and past the icon picture here to get the icon
/// </summary>
public static class Icon
{
public static string AngleRight = "\uf105";
public static string User = "\uf007";
public static string Lock = "\uf023";
}
}
Обновление:
Ответ: мы должны использовать это FontFamily=@"/Assets/Fonts/FontAwesome.ttf#FontAwesome"