Presenting Text with the TextBlock Control

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:

<TextBlock Name="TextBlock1" FontFamily="Tahoma"           FontSize="20" FontStyle="Italic"           FontWeight="Bold"           Text="Sample text with TextBlock">    <TextBlock.Foreground>        <LinearGradientBrush>            <GradientStop Offset="0" Color="Blue"/>            <GradientStop Offset="0.5" Color="Violet"/>            <GradientStop Offset="1" Color="Green"/>        </LinearGradientBrush> ...

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