This documentation is archived and is not being maintained.

TextDecoration.Location Property

Gets or sets the vertical location at which the text decoration is drawn.

Namespace: System.Windows
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public TextDecorationLocation Location { get; set; }
/** @property */
public TextDecorationLocation get_Location ()

/** @property */
public void set_Location (TextDecorationLocation value)

public function get Location () : TextDecorationLocation

public function set Location (value : TextDecorationLocation)

<object Location="TextDecorationLocation" .../>

Property Value

The vertical location at which the text decoration is drawn.

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 PenOffset property enables you to offset the text decoration from the specified Location.

In the following code example, a strikethrough text decoration is created with a solid color brush for the pen. The Location property is set to Strikethrough.

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

// Use the default font values for the strikethrough text decoration.
private void SetDefaultStrikethrough()
{
    // Set the underline decoration directly to the text block.
    TextBlock1.TextDecorations = TextDecorations.Strikethrough;
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: