简体   繁体   中英

WPF- “LineSpacing” in a TextBlock

I have a TextBlock I would like to pass a property of ' LineSpacing '. The thing with using " LineHeight " with LineStackingStrategy="BlockLineHeight" is that it also applies the LineHeight to the segment before the first line:

TextblockEx http://i61.tinypic.com/2a5y9mw.jpg

How can I manage to preserve said ' LineSpacing ' without modifying the LineHeight before the first line?

One thing I though might work is to separate each line in a Paragraph of a FlowDocument , since the Paragraph has a property Spacing Before Line and Spacing After Line .

Any help would be truly appreciated. Thanks in advance.

ANSWER

It seems that you can use LineStackingStrategy="MaxHeight" to avoid having leading on the first line. (Check answers below for full details).

PS Thanks to Mitch for the revelation :D

It seems that you can use LineStackingStrategy="MaxHeight" to avoid having leading on the first line:

<TextBlock LineStackingStrategy="MaxHeight" TextWrapping="Wrap" LineHeight="50">Lorem...</TextBlock>

Produces

最大高度

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM