inside a TextBlock:

Configuring superscript padding in a TextBlock <span>

I use <Span TextDecorations="Overline" BaselineAlignment="Bottom"> inside a TextBlock:

 <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Width="276"> Hello world. This is some text. This is an <Span TextDecorations="Overline" BaselineAlignment="Bottom"> OVERLINE </Span> </TextBlock> 

Production:

Screen shot

Is there a way to reduce the space between the vertex of the character and the subline? For example, I would prefer:

enter image description here

Very subtle downward transition, I know.

+4
source share
1 answer

The main idea is to create your own TextDecoration to suit your specific needs.

 <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Width="276"> Hello world. This is some text. This is an <Span BaselineAlignment="Bottom"> <Span.TextDecorations> <TextDecoration Location="OverLine" PenOffset="1" PenOffsetUnit="Pixel" /> </Span.TextDecorations> OVERLINE </Span> </TextBlock> 
+1
source

All Articles