Reputation: 9499
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?
Upvotes: 3
Views: 3073
Reputation: 93611
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.
Upvotes: 4
Reputation: 29256
to wrap text, you set the property TextWrapping to Wrap:
<TextBlock TextWrapping="Wrap"/>
Upvotes: 5