When the user scrolls down the grid (or pages down or arrows down), I need to detect when the last row becomes visible in the grid. What scroll event can I trap and what can I test to find this condition? Thanks.
Oh, I see. In that case, what I wrote should work, although I think the VisibleRows collection of the RowScrollRegion might include one of two rows beyond the actual view.
Won't this be a little off odd for your users? The grid's scrollbar will never be able to reflect the real row count the way you are implementing it. The user will scroll down to what they think is the bottom of the data, but it won't really be the bottom. They will have to keep scrolling and stopping and scrolling and stopping if they want to get all the way to the bottom.
You'd probably be better off using the UltraDataSource as your grid's data source and populating it from the BindingList on demand. The advantage of this is that you can set the total number of rows so the grid's scrollbar would look correct and if the users tried to scroll all the way to the bottom, you would know that you have to load data at the end of the list.
Sorting and filtering are also going to be an issue, either way. Assuming you are allowing the users to do either of these. :)
Since I don't want to use virtual data (my grid is bound to a bindinglist), and I only fetch a chunk of data at a time...I need to know when I hit the bottom to I can get another chunk of data and add it to the bindinglist (and effectively the grid)
Use the AfterRowRegionScroll event. You can check the VisibleRows collection of the ActiveRowScrollRegion - or the RowScrollRegion that is passed in to the event. I guess what you would do then is check the last visible row against the last actual row and see if they are the same.
Out of curiosity, why would you want this information? Seems like an odd thing to trap.