O
O
oatcookie2017-01-19 21:10:29
WPF
oatcookie, 2017-01-19 21:10:29

Text wrapping in WPF?

Evening in the hut, an hour of joy!
Got a question.
There is a template for displaying messages (UserControl).
It has a TextBlock for the message itself. Set TextWrapping to Wrap.
The text is wrapped. But until the height of the UserControl "runs out".
Question - how to stretch the height of the UserControl, depending on the height of the content?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zaitsev, 2017-01-19
@oatcookie

We need to make sure that:
- The UserControl (and its containers) are not in a container that does not allow dynamic expansion (a StackPanel with Orientation == Vertical will prevent us from expanding in height)
- Check properties like VerticalAlignment, Height, MaxHeight, etc.

D
d-stream, 2017-01-19
@d-stream

Well, probably VerticalAlignment to stretch and do not set the height, except maybe MinHeight

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question