我正在尝试使用Font Awesome在我的母版页中添加字体。 这是我的代码
new NavMenuItem { Id = 3, Title = "Home", TargetType = typeof(NavDetail), icon = ""}
这是我在主页enter code here
<Label VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
Text="{Binding icon}"
Style="{DynamicResource FontLabel}"
FontSize="24" />
问题是它只是打印出十六进制值而不是打印图标。如果我只是写Text =“”它可以工作,但当我尝试绑定它不起作用。
答案 0 :(得分:3)
正如您在Binding font awesome character in XAML to Text中所看到的,您可以使用unicode格式实现它。
您可以使用浏览器获取unicode值:
你只需要在斜杠('/')之后添加 u
答案 1 :(得分:1)
尝试以下
icon = ((char)0xf015).ToString();
答案 2 :(得分:0)
使用链接中的类: https://github.com/fzany/Font-Awesome-Cheat-Charp
public class FontAwesome
{
public static class Solid
{
public static string Ad = "\uf641";
public static string Address_Book = "\uf2b9";
public static string Address_Card = "\uf2bb";
public static string Adjust = "\uf042";
public static string Air_Freshener = "\uf5d0";
public static string Align_Center = "\uf037";
public static string Align_Justify = "\uf039";
public static string Align_Left = "\uf036";
public static string Align_Right = "\uf038";
public static string Allergies = "\uf461";
public static string Ambulance = "\uf0f9";
public static string American_Sign_Language_Interpreting = "\uf2a3";
public static string Anchor = "\uf13d";
public static string Angle_Double_Down = "\uf103";
public static string Angle_Double_Left = "\uf100";
public static string Angle_Double_Right = "\uf101";
public static string Angle_Double_Up = "\uf102";
public static string Angle_Down = "\uf107";
public static string Angle_Left = "\uf104";
public static string Angle_Right = "\uf105";
}
}