我如何找出用于fontAwesome中字符的XAML代码?

时间:2018-09-07 15:47:37

标签: android ios xamarin xamarin.forms font-awesome

在unicode中,我有一个"\uf2fc"指定的字符,有人可以告诉我如何将FO文档中显示的unicode格式转换为可以在XAML中使用的字符吗? XAML值曾经在网页上列出,但不再列出它们,而仅给出Unicode。

https://fontawesome.com/icons/rectangle-wide?style=regular

请注意,备忘单的新版本不像旧版本那样包含XAML代码。

https://fontawesome.com/cheatsheet/pro

1 个答案:

答案 0 :(得分:1)

另一种方法是实现“ FontAwesome.cs”类,然后用静态变量填充它:

public class FontAwesome
{
    public static string FAGlass = "\uf000";
    public static string FAMusic = "\uf001";
    public static string FASearch = "\uf002";
    public static string FAEnvelopeO = "\uf003";
    public static string FAHeart = "\uf004";
    public static string FAStar = "\uf005";
    public static string FAStarO = "\uf006";
    public static string FAUser = "\uf007";
    public static string FAFilm = "\uf008";
    public static string FAThLarge = "\uf009";
    public static string FATh = "\uf00a";
    public static string FAThList = "\uf00b";
    public static string FACheck = "\uf00c";
    public static string FATimes = "\uf00d";
    public static string FASearchPlus = "\uf00e";
    ...
}

然后,只要需要,您可以使用以下命令在您的xaml中访问它:

<Label Text="{x:Static fontAwesome:FontAwesome.FABriefcase}" />

请注意,这要求您将类包含在Xaml中:

xmlns:fontAwesome="clr-namespace:MyApp.Globals;assembly=MyApp"