0

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?

Janet
  • 1
  • 1

4 Answers4

0

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

klennepette
  • 3,176
  • 22
  • 23
0

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

Goblin
  • 7,970
  • 3
  • 36
  • 40
  • That kinda works, but if both expanders are large one will take all the space instead of evenly dividing it. – Janet Jun 12 '10 at 13:33
0

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..

SwissCoder
  • 2,514
  • 4
  • 28
  • 40
0

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.

Community
  • 1
  • 1
devios1
  • 36,899
  • 45
  • 162
  • 260