Question

This seems close to some other questions I've seen out here, but not close enough...

I have a grid with three rows. The first row holds a custom grid that I want to have as much space as possible. I set its Height to "*". The second row is a row of buttons; it is "Auto". The third row is a user control that contains another custom grid that has an unpredictable number of rows (none at design-time, filled in at run-time).

If I set the third row to "Auto", it doesn't get any space at all. I need to understand what I have to do after I load the third-row's grid to make it then figure out what "Auto" should be. Or, if "Auto" doesn't apply, how else do I get the third row to take up Just Enough space?

Does my custom grid have to fire something like a resized event after it is loaded?

Was it helpful?

Solution

You shouldn't have to do anything

If the 3rd row's Height is Auto, it will resize according to the size of it's contents. If the size of the contents change at runtime, so will the size of the Row.

You can also set limitations on the Row's Height by setting MinHeight and MaxHeight on the 3rd Row so it doesn't get smaller or larger than a specified height.

OTHER TIPS

Cells will collapse to fit their contents. If the contents don't have any specified size then the cell will collapse to nothing. I'm guessing for your middle row the buttons have fixed sizes, so the row collapses to the size of the buttons, but your third row has nothing with a fixed size so it collapses to nothing. Try giving your third row a fixed size either for the whole row or for each row in the contained grid.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top