Static Text

Although Silverlight includes a Label control, it's intended for data binding scenarios and discussed in Chapter 21. If you just want the best way to show blocks of formatted text, you're far better off with the lightweight, flexible TextBlock element, which you've seen at work in many of the examples over the past four chapters.

The TextBlock element is refreshingly straightforward. It provides a Text property, which accepts a string with the text you want to display.

<TextBlock Text="This is the content."></TextBlock>

Alternatively, you can supply the text as nested content:

<TextBlock>This is the content.</TextBlock>

The chief advantage of this approach is that you can add line breaks and tabs to make large sections of text ...

Get Pro Silverlight 5 in VB 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.