Text Elements in Silvelight

Broadly speaking, a text element in Silverlight is one of the following:

  • A Control that is intended to display text, or features text somewhere in its typical template and presentation
  • An Inline derived class, which can be used for formatting of the text displayed within a TextBlock
  • Certain control-specific types such as DataGridTextColumn

These elements share the characteristics of having a set of properties that control how text displays in the element or the element's content. These properties are: FontFamily, FontSize, FontStretch, FontStyle, FontWeight, and Foreground. The implementation of the properties is not necessarily shared between the elements as part of a common inheritance, but the implementations are similar in each text element.

TextBlock

The TextBlock object is the primary element for displaying read-only text in Silverlight-based applications. The following XAML example shows how to define a TextBlock element and set its Text property to a character string.

<TextBlock Text="Hello, world!" />