[UWP] [XAML] FontIcon在使用C ++ / WinRT动态绑定其Glyph值时无法正确显示字形 [英] [UWP][XAML] FontIcon not displaying the glyph correctly when binding its Glyph value dynamically using C++/WinRT
本文介绍了[UWP] [XAML] FontIcon在使用C ++ / WinRT动态绑定其Glyph值时无法正确显示字形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< FontIcon FontFamily =" Segoe MDL2 Assets" Glyph =" {x:Bind myGlyph}"> < / FontIcon>
这会显示一堆矩形而不是正确的字形。但是如果我直接硬编码字形值,例如:&&#xE768;"它会正常工作。
我怀疑它与hstring的转换有关,必须碰巧绑定该值。
解决方案
确保实体"&# xE768;"仅在XAML字符串文字中有效。如果您想在C ++代码中指定相同的字形,请使用 L" \ xE768"
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="{x:Bind myGlyph}"> </FontIcon>
This displays a bunch of rectangles instead of the correct glyph. But if I hard code the glyph value directly, for example: "" it will work correctly.
I suspect it has something to do with the conversion from hstring that has to happen to bind the value.
解决方案
Hi,
Make sure that the entity "" is valid only in XAML string literals. If you'd like to specify the same glyph in C++ code, use L"\xE768" .
这篇关于[UWP] [XAML] FontIcon在使用C ++ / WinRT动态绑定其Glyph值时无法正确显示字形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文