Reputation: 70287
Right now I have a problem with StackPanel
s inside DockPanel
s. Often the StackPanel
is taller than necessary for the contents, so the contents are stretched.
Is there something I can place in or around the StackPanel
to mean "don't cause children to consume all avaialble space".
Upvotes: 0
Views: 126
Reputation: 97671
Well, what do you want your StackPanel
to do? If you want it to only consume the visible space, use a grid. If you want to scroll the contents of your StackPanel
, I believe you can put it in a ScrollViewer.
Upvotes: 0
Reputation: 13501
AFAIK the contents of the StackPanel
do not "stretch" to fill it, anymore than any other control. i.e. the stretch to fill will be controlled by the HorizontalAlignment
and VerticalAlignment
of the child elements.
The default is usually Stretch
. Try setting it to Left
etc.
Upvotes: 2