Hallelujah!
Here is the solution pal in your property change it from
return "⌀50cm";
to
return ((char)0x2300).ToString();
and for 50cm
part you can always use mulitbinding or use char array and bind it to that.
:-)
题
I try to describe my problem more deeply. I have listbox full of item taken from ObservableCollection<show>
, in some cases I need to show DIAMETER SIGN with properly value at the listbox item area.
For example
If I would like to have it in every box I would put it hardcoded or make binding with hardcoded value, but only part of items have the value which should be showed with diameter sign. Here is the fragment of code from the show class, which should return the properly sign
public string Thickness
{
get
{
if (thickness == 1)
{
return "⌀28cm";
}
else if (thickness == 2)
{
return "⌀50cm";
}
else
{
return "";
}
}
}
and fragment of my code from xaml
<TextBlock
Foreground="#69AB5C"
FontSize="15"
VerticalAlignment="Bottom"
Text="{Binding Thickness}">
</TextBlock>
and here the question how should I pass from my observable collection the unicode character to xaml
解决方案
Hallelujah!
Here is the solution pal in your property change it from
return "⌀50cm";
to
return ((char)0x2300).ToString();
and for 50cm
part you can always use mulitbinding or use char array and bind it to that.
:-)
其他提示
You're using XML escape characters. You need to use C# character literals:
return "\x230028cm";