0
votes

i'm trying to get uwp app's initial page size to take on a specific width and height leveraging to ensure wrapping as necessary of TextBlock content.

If I don't set Width and Height properties at Page or Grid container for StackPanel layout control of content then the behaves as i'd expect it in the event where I use grab handles on view edges and corners to resize it.

If I do set Width and Height properties at Page or Grid container for StackPanel layout control of content then the does not appear to work at all.

What is the right way to set the desired initial Width and Height for uwp app Page and have the child Grid/StackPanel/TextBlock[@TextWrapping="Wrap"] content behave as expected when outer window resizing events occur?

1

1 Answers

1
votes

Ask far as I can see, what you mentioned is the right behavior. When you didn't define the size of your page or gird. The resize of your window makes your textblock also change it's size. As a result, the text in textblock will wrap according to your textblock. When you give grid or page a width, the stackpanel has to fit it's container so your textblock has a solid width, in this way, you cannot see wrap behavior any more.

Have you tried to avoid using stackpanel and binding your textblock's width to a value which will change based on resizing? In that way it may works like you expected.(Which looks like a animation)