TextBlock wrapping of text in Silverlight XAML file.
I have a wierd and annoying problem. I have a textblock that is inside a stackpanel that is Oriented horizontal. It would be nice if I could have the textblock appear in multiple lines nicely wrapped. How could I do that?
to wrap text, you set the property TextWrapping to Wrap:
<TextBlock TextWrapping="Wrap"/>
By default StackPanels do not limit the size of their contents in the direction of Orientation. That is the direction they keep on growing.
You mention you have it Orientation = Horizontal, so that will not constrain the width of a TextBox within it.
If you want text wrapping: you either need to use a grid for the container (which will constrain it's children) or set a fixed width on the TextBox.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.