我正在尝试使用 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=""它有效,但当我尝试绑定(bind)时它不起作用。
最佳答案
正如您在 Binding font awesome character in XAML to Text 中看到的那样,您可以使用 unicode 格式实现它。
您可以使用浏览器获取 unicode 值:
而且你只需要在斜杠('/')后面加一个u
关于c# - 母版页 Xamarin 表单上的绑定(bind)字体图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44668945/