Is there an event that I can use to trap when the user clicks on the Up or Down buttons in the grid's vertical scrollbar? I'm mostly interested in up.
I'm implementing batching with a datasource and the grid. I can easily use the OffEnd event of my datasource to populate more rows when scrolling down. However, it's possible that the batch of data that is initially retrieved doesn't actually start with the first record in the query. The user may have entered a starting filter value.
If this occured, I still need to be able to have the user scroll up in the grid while behind the scenes, I fetch more data. I've got this working if scrolling using the keyboard. I just need to know that the user clicked on the scrollbar up arrow so I can perform the same action.
Thanks,
JL
It's probably Min because the grid thinks it's already at the top row. If you scroll down and click the button, it will probably be Up at that point, since there are more rows above the viewable area.
But I'm just guessing.
I may have this figured out.
On a mouse click, I get the RowScrollbarUIElement and if the click is within the RowScrollbarUIElement.Rect, I then get the ElementFromPoint of the RowScrollbarUIElement and cast it to ScrollArrowUIElement. If this is a valid object and is the ScrollButtonType of ScrollButton.Min, then the Up Arrow button was clicked.
Curious that the ScrollButtonType isn't returned as Up rather than Min. The Down button returns Down, not Max...
Thanks Vince.
Unfortunately, if the first row of the grid is at the top of the viewport, neither the BeforeRowRegionScroll nor AfterRowRegionScroll methods are fired when the up button is clicked.
Can you suggest any other way to accomplish what I need?
There are no events specifically raised when the user clicks on the arrows of the scrollbar. The closest corresponding events are the BeforeRowRegionScroll and AfterRowRegionScroll events, which are raised on any vertical scroll action.
In the BeforeRowRegionScroll event, you get access to both e.OldState and e.NewState, both of which are RowScrollRegion objects. You can compare the ScrollPosition property of each to determine whether you scrolled up or scrolled down.