How can i set some text as subscript/superscript in FormattedText in wpf
A:
You can use something like <TextBlock>5x<Run BaselineAlignment="Superscript">4</Run> + 4</TextBlock>
.
However, as far as I know, you will have to reduce the font-size yourself.
winSharp93
2010-01-19 17:43:22
+2
A:
You use Typography.Variants:
<TextBlock>
<Run>Normal Text</Run>
<Run Typography.Variants="Superscript">Superscript Text</Run>
<Run Typography.Variants="Subscript">Subscript Text</Run>
</TextBlock>
Reed Copsey
2010-01-19 17:54:53
A:
I don't know if you need this to work with FormattedText specifically, or you mean derivations of Inline, but the following will work on Inlines, even if Typography.Variants="Superscript" fails to work.
TextRange selection = new TextRange(document.ContentStart, document.ContentEnd);
selection.ApplyPropertyValue(Inline.BaselineAlignmentProperty, BaselineAlignment.Superscript);
Hope it helps!
T. Webster
2010-10-03 23:32:27