TextBlock

The TextBlock control enables showing text messages. Its purpose is similar to the Label’s purpose, but it differs in that TextBlock offers deeper control over text customization. The following example demonstrates how you can present customized text using the TextBlock:

image

Font properties are of particular interest. FontFamily indicates the font name, FontStyle indicates if the font is normal or oblique, whereas FontWeight sets the font depth. IntelliSense enhancements in WPF 4 enable easy selections for available members on each of the previously mentioned properties. Figure 32.21 shows the result of the preceding code.

Figure 32.21 Drawing ...

Get Visual Basic® 2010 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.