O'Reilly logo

Pro Silverlight 5 in VB by Matthew MacDonald

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

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 ...

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