I need to format some string in Superscript (code behind) in c#,
for example,
Input => 100 Output => 10^2
where Output<string> is a Clr Property
I have tried with the below code snippet,
TextBlock _textBlock = new TextBlock();
_textBlock.Text = "10";
_textBlock.Inlines.Add(new Run() { BaselineAlignment = BaselineAlignment.Superscript, Text = "2"});
As Typography is Read Only property in the above case, i can't set the Typography.Variants in code behind.
Note: Please do note that this question is not about rendering, this is about reading the Text as string. Expected value is 10^2. While suggesting duplicates please check other question addresses this.
Could any one guide me on this?
And also while set BaselineAlignment.Superscript like the above mentioned code snippet, it doesn't render like the superscript (small font) instead it renders in the same FontSize (instead it looks like setting the Margin property for the superscript content alone like new Thickness(0,0,0,FontSize) )