c# - 母版页 Xamarin 表单上的绑定(bind)字体图标

标签 c# xamarin binding xamarin.forms font-awesome

我正在尝试使用 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 值:

enter image description here

而且你只需要在斜杠('/')后面加一个u

关于c# - 母版页 Xamarin 表单上的绑定(bind)字体图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44668945/

相关文章:

c# - 如何实现显示 "Type here"的 TextBox?

objective-c - UITextField 不可点击/不可触摸

php - 如何使用 mysqli 将变量传递给 WHERE 子句?

PHP ↔ Perl 接口(interface)或绑定(bind)

wpf - 绑定(bind)多个 View 模型

c# - DataGridColumn 与动态生成的数据绑定(bind)

c# - YouTube V3 API - Google.Apis.Requests.RequestErrorBackend 错误 [503]

c# - 为什么/optimize 在 C# 项目中生成比未启用此功能更多的代码分析警告?

android - 如何在滚动后恢复 ViewGroup 对 TouchEvents 的处理

image - 如何上传带有描述和标题等元数据的图像