This documentation is archived and is not being maintained.

TextDecoration Class

Represents a text decoration, which a visual ornamentation that is added to text (such as an underline).

Namespace:  System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

<LocalizabilityAttribute(LocalizationCategory.None)> _
Public NotInheritable Class TextDecoration _
	Inherits Animatable
Dim instance As TextDecoration
<TextDecoration .../>

There are four types of text decorations: underline, baseline, strikethrough, and overline. The following example shows the locations of the text decorations relative to the text.

Example of text decoration types

Diagram of text decoration locations

The following example shows a text decoration that has been styled with a linear gradient brush and a dashed pen.

Example of an underline styled with a linear gradient brush and dashed pen

Text decoration with linear gradient underline

Notice that TextDecoration is derived from Animatable. This makes it possible to apply animated effects to the decoration elements, using a DoubleAnimation for the PenOffset and a ThicknessAnimation for the Pen.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0