Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
835
Need to find entire grid height
posted

Hi,

I have a grid setup without a scrollbar (I've used the this.DisplayLayout.MaxRowScrollRegions = 1; property, which I believe forces the entire grid to display without the need for scrolling). The reason that I'm doing this is that I'm embedding the grid as a whole into another control for viewing all in one big snapshot. In order to do this, I'm adding the grid to a container. The container sometimes needs to know the final size of that grid in order to know how to big to make itself. I've taken a look at the Height property on the UltraGrid, but that doesn't seem to give the right height of the final grid with data (the resulting grid in my case ends up being quite large...anywhere from 100 to 1000 rows tall). Is there some property that I'm missing which would give me a good indicator of how long vertically the grid is (including headers)? I've tried doing back of the hand calculation that looks something like this: <Height of header> + <Number of rows> * <DefaultRowHeight property>, but that doesn't give me a correct height either.

Thanks,

Charley

Parents
  • 469350
    Offline posted

    Hi Charley,

    tamalecharley said:
    I have a grid setup without a scrollbar (I've used the this.DisplayLayout.MaxRowScrollRegions = 1; property, which I believe forces the entire grid to display without the need for scrolling).

    No, that's not what this property does. All it does is remove the user's ability to create multiple scroll regions by dragging the little button on top of the vertical scroll bar.

    The grid has no mode where it will automatically adjust it's height to the contents. This is, in fact, very complex and difficult for the grid to do internally, because there are so many possible options. It's a little easier for you to do it yourself, since you can make assumptions about which features you are using.

    You would have to account for the headers (column and band), the height of every row, and the horizontal scrollbar (if there is one). If the rows are all the same height, then you could just multiply the row height times the number of rows, but even this can be tricky, because sometimes the rows overlap by a pixel, depending on the RowLayoutStyle and the border styles of the cells and the rows.

Reply Children