I'll try to give you a more complete answer for anyone googling this issue.
Silverlight_kid was right in saying that sub/superscript in Silverlight is limited due to not supporting "BaseLineAlignment", but not in saying that it is then only possible with positioning.
You can achieve limited sub/superscript without positioning (limited to numbers and basic arithmetic) by using unicode letters. Hopefully, Silverlight will be updated in the near future to support this. Until then, I will be working on getting the positioning working correctly and easily. I have to for a project anyway and I might as well release the code if I can manage it.
Other Notes:
1. Silverlight (more accurately, the Portable User Interface font that Silverlight defaults to) only supports versions of Unicode through Unicode 2.1, not the latest version (5.2).
2. To construct a string with unicode characters, you need a backslash followed by an 'x' followed by the four digit hex code for that character. Only characters in the Basic Multilingual Plane (0000-FFFF) are supported. See examples.
string water = "H" + "\x2082" + "O"; // You can split the string up if you want. string ammonia = "NH\x2083"; // Or not split it. string energy = "e=mc\x00B2"; // Most well-known, poorly understood equation. string PythagoreanTheorem = "a\x00B2+b\x00B2=c\x00B2"; \\ Also well-known.
3. Character reference.
Superscript:
0 : U+2070
1 : U+00B9
2 : U+00B2
3 : U+00B3
4-9 : U+2074-2079
+ : U+207A
- : U+207B
= : U+207C
( : U+207D
) : U+207E
n : U+207F
Subscript
0-9 : U+2080-2089
+ : U+208A
-: U+208B
=: U+208C
(: U+208D
): U+208E
I know the question is a little old, but I thought I'd add a comment anyway. You can use unicode letters in xaml like you would use any other special characters in xml:
'>': > or b
"m³": "m³"
"H₂O": "H₂O"
"eⁿ": "eⁿ"
You probably get the drift.
I haven't tried all the codes posted by lordcheeto, but they should work.
浙公网安备 33010602011771号