[Windows Phone] Textblock tip and trick – Part 1

So, you have been working with Windows Phone for quite a while now

Today I will walk you through a few small tricks for using the Textblock in Windows Phone

advanced text

1. Multiple lines in the same Textblock

This is a regular textblock

The question is: how do you display 2 lines inside this Textblock?

Problem Solved :D

And what about in C# code?

2. Justifying a Textblock on both sides

Hold on, what’s so hard about justifying both sides? Just use Justify and you’re done

This is Right

This is Center

And this is Justify

2.1. The solution

Use a RichTextBox, like in the picture below

Problem Solved

3. Run Control

In the examples above you ran into the keyword “Run” several times. It is a child control that sits inside the TextBlock, TextBox and RichTextBox controls.

The Run Control lets you display different pieces of text inside the same TextBlock or TextBox control. Each Run Control carries its own formatting properties.

That’s all — see you in part 2