TextDecoration::Pen Property
.NET Framework (current version)
Gets or sets the Pen used to draw the text decoration.
Assembly: PresentationCore (in PresentationCore.dll)
Property Value
Type: System.Windows.Media::Pen^The Pen used to draw the text decoration. If this value is null, the decoration color matches the text to which it is applied and the decoration's thickness is set to the font's recommended thickness.
In the following code example, an underline text decoration is created with a linear gradient brush for the dashed pen.
<!-- Use a linear gradient pen for the underline text decoration. --> <TextBlock FontSize="36">the lazy brown dog. <TextBlock.TextDecorations> <TextDecorationCollection> <TextDecoration PenThicknessUnit="FontRecommended"> <TextDecoration.Pen> <Pen Thickness="1.5"> <Pen.Brush> <LinearGradientBrush Opacity="0.5" StartPoint="0,0.5" EndPoint="1,0.5"> <LinearGradientBrush.GradientStops> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Pen.Brush> <Pen.DashStyle> <DashStyle Dashes="2"/> </Pen.DashStyle> </Pen> </TextDecoration.Pen> </TextDecoration> </TextDecorationCollection> </TextBlock.TextDecorations> </TextBlock>
.NET Framework
Available since 3.0
Available since 3.0
Show:
