0
votes

I have two Expanders in a grid, both in Auto sized rows. When the height of the Expander is very large, the row overflows out of the grid.

Is there a way to have Auto sized rows that take only the grid space that's available?

4

4 Answers

0
votes

Try setting the MaxHeight property on either the expander object or the object inside the expander.

0
votes

You could use a DockPanel instead - and then dock the first Bottom and let the other fill. Or put each Expander inside a ScrollViewer.

0
votes

i would set the last rowDefinition to Height="*", then the last row fills out all the space left.

but it doesnt help if not only the last row would overflow..

0
votes

See my custom auto-sizing panel/grid class here. I wrote it specifically to address this problem--full source is in the question.

(To use it, create a new class that inherits from panel and paste the working code into the class, then use the custom class just like a StackPanel.)

It currently only supports Vertical orientation, but could easily be modified to support Horizontal as well.