windows-phone-7 - WP7 中的上标和下标

标签 windows-phone-7 xaml subscript superscript

我正在尝试在 PivotItem header 中显示下标为 2 的“H2O”。

例如

<controls:PivotItem Header="H20">
</controls:PivotItem>

我还想将代码隐藏中的相同值分配给 TextBlock.Text。

例如

textBlock1.Text = "H2O"; // 2 to appear as subscript.

对于用于 WP7 的 Silverlight 版本,这可能吗?

最佳答案

经过一番搜索,我找到了解决方案。

来自 SubScript and SuperScript in TextBlock通过 Troels Pedersenlordcheeto分别。

在XAML中,下标2可以用Unicode表示。

例如

<controls:PivotItem Header="H&#x2082;0">
</controls:PivotItem>

后面的代码也类似。

例如

textBlock1.Text = "H\x2082O"; // 2 appears as subscript.

这种方法有一些限制,因为仅支持基本多语言平面 (0000-FFFF) 中的字符,并且所使用的字体也需要支持这些字符。

关于windows-phone-7 - WP7 中的上标和下标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8932091/

相关文章:

r - 如何在ggplot的facet_grid函数中应用下标

windows-phone-7 - 包裹面板不会滚动

silverlight - Windows Phone 7/银光 : How to do navigation?

c# - Vici coolstorage 文本字段在 WP7 应用程序中未正确显示(某些字符丢失)

c# - 隐藏元素与 DataTriggers

python - 类中的可订阅对象

utf-8 - 下标字母的UTF8符号

windows - 使用 Linq to XML 将 XElement 添加到 XML 文件

c# - GridViewColumn.Width 绑定(bind)并双击以自动调整列大小

wpf - "A value of type FixedToolBar cannot be added to a collection or dictionary of type ' UIElementCollection '"但 FixedToolBar 是 UIElement 的子类