I have a TextBlock with a fixed size and variable text. I want my text to always fit into a TextBlock (without an ellipse or overflow, but with word wrap). If the text changes, the font size must be adjusted so that the text matches the borders of the TextBlock.
I know that I can pack a TextBlock into the viewport (which I am doing now), but I do not have a word wrapper.

The figure above shows three different text blocks (the blue numbers are for illustration only). If I use Viewbox, I get results like in 1 and 2, but I prefer results like 1 and 3.
So I'm basically trying to combine Viewbox and word wrap. How can this be done?
source
share