TextDecorations Class
Provides a set of static predefined text decorations.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
The TextDecorations type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | Baseline | Specifies a baseline TextDecoration. |
![]() ![]() | OverLine | Specifies an overline TextDecoration. |
![]() ![]() | Strikethrough | Specifies a strikethrough TextDecoration. |
![]() ![]() | Underline | Specifies an underline TextDecoration. |
In the following example, a strikethrough text decoration uses the default font value.
<!-- Use the default font values for the strikethrough text decoration. --> <TextBlock TextDecorations="Strikethrough" FontSize="36" > The quick red fox </TextBlock>
You can also specify multiple text decorations for the same text. In the following example, an underline and overline text decoration are used for the same text.
<!-- Use both an underline and overline text decoration for the same text. --> <TextBlock TextDecorations="Underline, Overline"> The quick red fox </TextBlock>
You can use the string value "None" to indicate that there are no text decorations in the TextDecorations collection. In the following example, the TextDecorations collection is set to "None".
<!-- Set the text decoration collection to None to indicate no decorations. --> <TextBlock TextDecorations="None"> The quick red fox </TextBlock>
You can remove all text decorations from text by using the Clear method. In the following example, the TextDecorations collection is cleared.
By default, Hyperlink uses a TextDecoration object to display an underline. The following markup sample shows a Hyperlink defined with and without an underline:
<!-- Hyperlink with default underline. --> <Hyperlink NavigateUri="http://www.msn.com"> MSN Home </Hyperlink> <Run Text=" | " /> <!-- Hyperlink with no underline. --> <Hyperlink Name="myHyperlink" TextDecorations="None" MouseEnter="OnMouseEnter" MouseLeave="OnMouseLeave" NavigateUri="http://www.msn.com"> My MSN </Hyperlink>
TextDecoration objects can be performance intensive to instantiate, particularly if you have many Hyperlink objects. For more information, see How to: Use a Text Decoration with a Hyperlink.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

