I have a TextBlock that has a fixed size and variable text. I want my text to always fit in the TextBlock (without ellipsis or overflow, but with word wrap). If the text changes, the font size should be adjusted so that the text fits to the bounds of the TextBlock.
I know I could pack the TextBlock into a Viewbox (which I'm doing currently) but than I don't have word wrap.
The image above shows three different TextBlocks (the blue numbers are just for illustration). If I use a Viewbox I get results like in 1 and 2 but I rather want results like in 1 and 3.
So I'm basically trying to combine Viewbox and word wrap. How can this be done?
If you restrict the viewbox expansion to one dimension, then you can still have your wrap and something close to #3. Try this answer
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