O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Formatting Text at Runtime

You can format text in a RichTextBox at the paragraph-level and inline-level at runtime. The following example shows how you can right-align the entire contents of the RichTextBox within a Button.Tap event handler:

void Button_Tap(object sender, System.Windows.Input.GestureEventArgs e){    foreach (Block block in richTextBox1.Blocks)    {        block.TextAlignment = TextAlignment.Right;    }}

Figure 6.11 shows the contents of a RichTextBox after it has been right-aligned via a Button placed within the Paragraph.

Image

FIGURE 6.11 Tapping an inline Button causes the Paragraph to be right-aligned. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required