It’s always been a problem for the developers of windows phone that they are unable to write mathematical equations on windows phone when they are building applications for mathematics. Especially beginners face a lot of problem while doing it.
How can you write a mathematical equation? How can you view as it is?
Here is a simple way of doing it.

Let us have equation as follow.

I have a text block in XAML of my application that is “MathTB” , now in C# code I will write my equation.

Here I have used Unicode to display the super script \u00B2' is used to display the super script in windows phone in a text block

In other cases you may use a rich text block to perform different properties and layouts of the text.

These may be

Ø  Bold Text

Ø  Underlined Text

Ø  Colored and Black text at same time

Ø  Italics and Bold at same time

And many more you can use,

MathTB.Text = "(x + 1)";

MathTB.Text += String.Format(" {0,-3}", '\u00B2');

MathTB.Text += " = ";

MathTB.Text += "x";

MathTB.Text += String.Format(" {0,-3}", '\u00B2');

MathTB.Text += " + ";

MathTB.Text += "2x + 1";

In this case I have programmatically displayed a rich text box and applied few features of it.

Paragraph prgParagraph = new Paragraph();

// create some text, and add it to the paragraph

Bold bldText = new Bold();

bldText.Inlines.Add(new Run() { Text = "(x + 1)" });

Italic itlText = new Italic();

itlText.Inlines.Add(new Run() { Text = String.Format(" {0,-3}", '\u00B2'), Foreground = new SolidColorBrush(Colors.Yellow) });

Underline unText = new Underline();

unText.Inlines.Add(new Run() { Text = "This is some example text, underlined" });

Bold bldTextWithItalic = new Bold();

{

Inlines = { new Run()

{ Text = "This is some example text, bold and italic" } }

});

Note: You can change color of text if you want. By using SolidColorBrush(Colors.~your color~)

That is all you need to do when you are going to write an equation of mathematics in windows phone using a rich textbox or a simple text block.

Happy coding!