This documentation is archived and is not being maintained.

TextDecorations Class

Provides a set of static predefined text decorations.


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

public ref class TextDecorations abstract sealed
<object textDecorationsProperty="textDecorationType[,textDecorationType]"/>

XAML Values


The type of text decoration: Baseline, OverLine, Strikethrough, or Underline. More than one decoration is permitted, with values separated by commas. You can also specify "None" to indicate no type of text decoration.

The TextDecorations type exposes the following members.

Public propertyStatic memberBaselineSpecifies a baseline TextDecoration.
Public propertyStatic memberOverLineSpecifies an overline TextDecoration.
Public propertyStatic memberStrikethroughSpecifies a strikethrough TextDecoration.
Public propertyStatic memberUnderlineSpecifies an underline TextDecoration.

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

Example of text decoration types

Diagram of text decoration locations

In the following example, a strikethrough text decoration uses the default font value.

No code example is currently available or this language may not be supported.

<!-- Use the default font values for the strikethrough text decoration. -->
  FontSize="36" >
  The quick red fox

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

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

You can remove all text decorations from text by using the Clear method. In the following example, the TextDecorations collection is cleared.

No code example is currently available or this language may not be supported.

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="">
  MSN Home

<Run Text=" | " />

<!-- Hyperlink with no underline. -->
<Hyperlink Name="myHyperlink" TextDecorations="None"
  My MSN

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.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.

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