I'm having trouble with wrapping some text in a TextBox in WPF.
Let's say I have following text "Here is some VeryLongTextThatHasToBeWrapped and so on".
<TextBox Text="Here is some VeryLongTextThatHasToBeWrapped and so on" TextWrapping="Wrap" MaxWidth="70" Height="150"/>
I'd expect that text would wrap in the first line as it doesn't fit in the TextBox. Like here:
Expected wrapping
However wrapping happens on the next line, so I have unused space and the whole text does't fit in the TextBlock. Like here:
Actual wrapping
I tried to play with Width and Height , tried to set TextWrapping to WrapWithOverflow .
Also, I played aroud with Run elements with InlineUIContainer with no luck.
Still can't get the desired result.
Is there any way to "force" wrapping to break a word as soon a possible instead of giving it maximum possible space and then breaking it?
You can consider string as array of chars and present it in an
ItemsControl, where you setItemsPaneltoWrapPanel, of course it's then not editable.