问题
I have a Xamarin application with a Label
which is Bound
like so:
<Label Text="{Binding BackSpace}"/>
and a property in my viewmodel like so:
public string BackSpace
{
get
{
ResourceManager temp = new ResourceManager("MyProgram.ResourceStrings", typeof(MyClass).GetTypeInfo().Assembly);
result = System.Text.RegularExpressions.Regex.Unescape(temp.GetString("Backspace"));
}
}
now I have an element in my ResourceStrings
called Backspace
and I am trying to get the string associated with this key which I want to be the Android Backspace
- ⌫
So initially I set the resource equal to the symbol ⌫
but this just gives me a label containing ?
Now I try set it equal to the HTML hex code from here: ⌫
but this gives me ⌫
How do I get my label to display the ⌫
symbol?
PS. - Even if I try:
<Label Text="⌫"/>
I get a blank label
回答1:
You'll need to change your label's font to a font which contains backspace as glyphicon.
You'll need two things:
- Appropriate font. Probably Noto Sans Symbols https://www.google.com/get/noto/#sans-zsym. ⌫ symbol
- Label renderer which allows custom fonts. See here: https://github.com/XLabs/Xamarin-Forms-Labs/wiki/ExtendedLabel
This Xamarin link will provide more infomation on working with Fonts
来源:https://stackoverflow.com/questions/32351677/how-do-i-display-android-backspace-in-label