【问题标题】:How can I find out the XAML codes used for characters in fontAwesome?如何找出用于 fontAwesome 中字符的 XAML 代码?
【发布时间】:2019-02-13 00:07:06
【问题描述】:

在 unicode 中,我有一个由"\uf2fc" 指定的字符,有人可以告诉我如何将 FO 文档中的 unicode 表单显示转换为我可以在 XAML 中使用的那些吗? XAML 值曾经在网页上列出,但现在不再列出,只给出 Unicode。

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

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

https://fontawesome.com/cheatsheet/pro

【问题讨论】:

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


【解决方案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"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多