In WPF, if you have inline Runs inside of a text block, word-wrapping works on a per-letter basis. I'd like it to use the default functionality that is word-by-word wrapping, i.e:
lorem
ipsum
instead of
lorem ip
sum
I'm generating the inline Runs programmatically, code snippet as follows:
TextBlock tb = new TextBlock() {
TextWrapping = TextWrapping.Wrap
};
foreach (string part in parts)
{
tb.Inlines.Add(new Run(part));
}
The Runs are woven inside the TextBlock with InlineUIContainers that contain Images. If I set the Text property of the Textblock instead of using Runs it works normally, but I can't do that and weave in images with the text. Very open to alternative solutions as well.
erotavlas suggested I use tb.Inlines.Add(part)
instead and it works precisely as requested.