[英]Textblock binding issues with converter
I am trying to use the font icon in my TextMlock control to display specific icon. 我正在尝试在TextMlock控件中使用字体图标来显示特定的图标。 For this, I use text block binded with some text which is converted through a converter to a specific symbol code. 为此,我使用绑定了一些文本的文本块,这些文本通过转换器转换为特定的符号代码。 But instead of displaying that particular symbol the text block is displaying the symbol code without &#
characters. 但是,文本块不是显示该特定符号,而是显示不带&#
字符的符号代码。 Am I doing something wrong here? 我在这里做错什么了吗?
Converter class: 转换器类别:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var catagoryString = value?.ToString().Trim();
var returnString = string.Empty;
if (stringConditionOne)
{
return "";
}
if (strinConditionTwo)
{
return @"🔖";
}
return "";
}
Textblock binding: 文本块绑定:
<TextBlock
Grid.Row="0"
Grid.Column="4"
FontFamily="Segoe UI Symbol"
FontSize="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding TextProperty, Converter={StaticResource stringToSymbolConvertor}}"
TextAlignment="Center" />
从后面的代码使用\\ u
"\ue1ef;"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.