Fill the baseline decoration with a linear gradient brush
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="TextDecorationExample.Window1"
Title="TextDecoration Example"
Width="720"
Height="400">
<StackPanel>
<TextBlock FontSize="24" Width="180" VerticalAlignment="Center">The lazy dog
<TextBlock.TextDecorations>
<TextDecoration Location="Baseline"
PenThicknessUnit="FontRecommended">
<TextDecoration.Pen>
<Pen Thickness="3">
<Pen.Brush>
<LinearGradientBrush Opacity="0.5"
StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="Orange" Offset="0" />
<GradientStop Color="Red" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Pen.Brush>
</Pen>
</TextDecoration.Pen>
</TextDecoration>
</TextBlock.TextDecorations>
</TextBlock>
</StackPanel>
</Window>
Related examples in the same category