I have multiple TextBlocks
in a control. The blocks have a fixed width and the TextWrap
property is set to Wrap
. The text is provided via binding.
Right now the wrapping occurs when SL detects that it can't fit another character in the line. Which results in something like "The quick bro" \r\n "wn fox jumps".
But I want those blocks to wrap their text only at word boundaries and not at some random position in the middle of a word. The expected outcome should look something like "The quick brown" \r\n "fox jumps".
This is the XAML for one of the TextBlocks
:
<TextBlock
x:Name="Foo"
Foreground="#FFD4E4FF"
FontSize="14.667"
FontFamily="Arial"
Canvas.Left="586.671"
LineHeight="23.707"
TextWrapping="Wrap"
Text="{Binding Bar}"
Canvas.Top="170"
Width="120" />
Any ideas?
TextBlock
just stubbornly wraps by words, not letters, when there`s enough width to fit a word. – icebatTextBlocks
is ridiculously complex. I copied a lot of the stuff from there to a blank solution to find what causes that weird wrapping behavior. But as you said: It keeps wrapping by words. I guess some combination of controls in there really messes up the wrapping process. – Sebastian WeberTextBlock
with given height and width just can`t fit whole text with word wrapping, then it`s forced to break words. – icebat