I am using WPF, there is a TextBlock in my UserControl. The Text is very long, so I wrap it with TextWrapping = Wrap. The question is, how can I change the line spacing?
The code is something like:
<TextBlock Text="abcdefghijklmn" TextWrapping="Wrap"/>
The output is like:
abcdefghijk lmn
What I want is:
abcdefghijk <--increase this line spacing--> lmn
Great Thanks.
TextBlock is not editable.
Text block is the primary control for displaying read-only text in apps. You can use it to display single-line or multi-line text, inline hyperlinks, and text with formatting like bold, italic, or underlined.
The TextBlock control provides flexible text support for UI scenarios that do not require more than one paragraph of text. It supports a number of properties that enable precise control of presentation, such as FontFamily, FontSize, FontWeight, TextEffects, and TextWrapping.
Use LineHeight
together with LineStackingStrategy="BlockLineHeight"
Like
<TextBlock Text="abcdefghijklmn" TextWrapping="Wrap" LineStackingStrategy="BlockLineHeight" LineHeight="30"/>
(credz Mixer for the BlockLineHeight addition)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With