c# - 如何在 Xamarin Forms 中从 Font-Awesome 中排除字符串
问题描述
如何将字符串从格式化中排除为 Font-Awesome 图标?
在我的例子中,我在 XAML 中有一个标签,它有一个文本绑定到一个字符串。这个标签的字体系列是 Font-Awesome。在我的 C# 代码中,字符串如下所示:
CurrentSorting = "Date \xf062";
输出如下所示:
D@e(和 \xf062 图标)
但是我希望输出是这样的:
日期(和 \xf062 图标)
我怎样才能做到这一点?
[编辑]
我在 XAML 中的标签:
<Label
Margin="10,0,0,0"
TextColor="#FF9340"
Text="{Binding CurrentSorting}"
FontFamily="{StaticResource Font-Awesome}"
HeightRequest="40"
VerticalTextAlignment="Center"/>
C#代码:
case "4":
{
CurrentSorting = "Date \xf062";
Entries = new ObservableCollection<Entry>(Entries.OrderBy(x => x.Date).ToList());
break;
}
资源字典:
<OnPlatform x:TypeArguments="x:String" x:Key="Font-Awesome">
<On Platform="Android" Value="Font-Awesome.ttf#Font-Awesome" />
<!--<On Platform="iOS" Value="Raleway-SemiBold" />-->
</OnPlatform>
解决方案
推荐阅读
- sql - 使用 PostgreSQL 创建触发器
- python - requirements.txt 中的 Dask 数据框?
- r - 选择R中向量中的所有值组合
- python - 用于散列算法的 Python 索引为 None
- csv - 如何在不导入空值的情况下从 csv 在 Quick Base 中进行更新导入?
- css - css 固定标题无法正确显示下拉菜单的问题
- symfony - 问题兼容性 symfony/symfony 3.3.* 和 symfony/dotenv 3.4
- javascript - 如何在没有任何条件的情况下返回切换参数javascript
- javascript - 通过大数据的ajax创建动态选择框
- c# - 如何检查数组中的下一个元素?