I'm looking for suggestions or strategies to handle vertically re-sizing grids (automagically). Specifically, I'd like a grid to grow it's height until it reaches a max height, or all rows are currently displayed (no scrolling).
First, have I missed a setting that can do this?
Second, assuming No to the first, what would be the most pragmatic way to determine if the grid is clipping some rows? And following that, to determine how many are being clipped, and what their height is.
I'm open to other suggestions. Maybe I've missed some combination of table/bag/flow layout manager with AutoResize control settings.
Thanks,
Frank
I did come up with a solution for this. It's not pretty and it's by no means complete, but it will correctly resize a grid in most circumstances.
I originally wrote it as a UI Filter, but it was being called too often, and I had to govern it. I've since wrote it as an inherited class. It runs only when needed now, and performs well. Still lots of edge cases not handled properly, but works enough for me.
The hardest part is in determining how many rows are being clipped, and thus how much bigger to make the grid rectangle. Infragistics developers could implement a few new properties and make this much easier. Or they could actually implement .AutoSize = TRUE.
-frank
Frank,
Were you able to come up with a solution for this problem?
I'm trying to accomplish the same thing. Any help would be appreciated.
Thanks!
Sherry
Hi Frank,
foconnor said:First, have I missed a setting that can do this?
No, you are not missing anything, there is no property for this. You should submit a feature request to Infragistics.
Request a Feature or Component
There is really no easy way to acheive this. You might be able to use the ActiveRowScrollRegion.VisibleRows.Count to determine how many rows are actually visible and compare this to the number of actual rows in the grid to see if you need to make the grid bigger. But determining the exact height needed is no small task, as you would need to account for all the rows, headers, and scrollbars. This is trickier than it sounds because sometimes the grid rows overlap by a pixel because of the borders.
Another way to go might be to try to calculate the neccessary height by examining the UIElements inside the grid. If you want to go this route, I suggest getting the Infragistics UIElementViewer Utility