I'm currently trying to place a resizing XamDataGrid in the middle of a Grid layout. The problem seems to be that if I give the RowDefinition a Height of Auto, it resizes properly to the small size but when there are too many records it bumps all of the other Rows below it out of view. When I set the RowDefinition Height to *, it doesn't resize at all, which at this point is more desirable but then the Grid ends up taking up more room than it needs to, since there may only be one or two records in the Grid.
In a basic sense, this is what my grid looks like. The local:Grid view is the resizing one that bumps my border toolbar and dock manager off the page.
No problem. Thanks for posting the code.
Rob,
The fix I ended up implementing a code-behind fix that does what I need when certain buttons are clicked. It's not ideal and it may prove a bit more complicated with other functionality that isn't strictly button clicks, but it definitely works for now. I've posted the code below for others who may be interested.
Hi Danielle,
That seems to be the best approach to achieve what you are looking for. Since you have some "Auto" in the mix, they don't respect the other row definitions width. The only row definition types that respect other row definitions are the star (*) ones. Auto row definitions are in their own little world. So if you can calculate the max height that you want for that particular row you can keep it from growing too much to kick the other row off screen.
The MinHeight is definitely still respected though. The issue is that the rest of the row definitions are just too large and they forced that row off the screen. It's still there though and the control inside the row should be the MinHeight as well.
I guess I was under the assumption that because there are two elements below the resizing grid that it would have to respect their space before sizing itself and shoving the other elements out of vision, particularly because the two below elements have MinHeights.
I'll look into declaring a reasonable MaxHeight that is somehow calculated based on what sort of remaining space is required and how much screen real estate the user has.
Thanks,
Danielle
That was a flub on my part. It was supposed to be MaxHeight. Honestly though, I'm not sure how else you plan for this to work. If you need to keep the content from being pushed off screen but still want the grid to grow in size as more rows are added then there needs to be a MaxHeight set somewhere to keep the grid from growing too large. I think first you need to determine what you want to happen when the grid size grows to the point where the content below it is pushed off the page. Depending on the result that you want, we can tailor the implementation to produce that effect.