Expand Minimize

TextDecorationLocation Enumeration

Specifies the vertical position of a TextDecoration object.

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

type TextDecorationLocation
<object property="enumerationMemberName" .../>

Member nameDescription
BaselineThe vertical position of a baseline.
OverLineThe vertical position of an overline.
StrikethroughThe vertical position of a strikethrough.
UnderlineThe vertical position of an underline. This is the default value.

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

Text decoration types

Diagram of text decoration locations

The following example creates an underline text decoration and uses a solid color brush for the pen.

No code example is currently available or this language may not be supported.
<!-- Use a Red pen for the underline text decoration -->
<TextBlock
  FontSize="36" >
  jumped over
  <TextBlock.TextDecorations>
    <TextDecorationCollection>
      <TextDecoration 
        PenThicknessUnit="FontRecommended">
        <TextDecoration.Pen>
          <Pen Brush="Red" Thickness="1" />
        </TextDecoration.Pen>
      </TextDecoration>
    </TextDecorationCollection>
  </TextBlock.TextDecorations>
</TextBlock>

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft