Displaying Text Using the TextBlock

The TextBlock is an essential element in most Windows Phone XAML apps. It represents a section of text and is normally used to label controls or control groups. The TextBlock supports word wrapping, so that long runs of text are not hidden when they exceed the width of the control. The following code shows how to create a TextBlock in XAML, using the built-in PhoneTextNormalStyle:

<TextBlock Text="Windows Phone 8 Unleashed"    Style="{StaticResource PhoneTextNormalStyle}" />

Alternatively, the TextBlock also allows you to nest content within the TextBlock element, like so:

<TextBlock Style="{StaticResource LabelTextStyle}">    Windows Phone 8 Unleashed ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.