We are having a problem with the grids whereas if the user click the bottom row of the grid, the grid automatically moves the scroll bar to show the full row. This is not acceptable because as users are trying to double click on a row, the scroll bar moves and the row that ends up being clicked is the wrong one. There is also a case where we have a form with multiple grids in an mdi container. When we click on the grid near the bottom of the container, the containers scroll bar jumps moving each of the grids up, causing the wrong row to be clicked, and effectively performing a sort of "shift click" selecting all rows between the initial and the row the mouse ended on. This is causing our users a large headache, and no one here can figure out what could be causing this. Please help.
Strangely enough, calling FocusControlWithoutScrollingIntoView still scrolls! I placed that code under the MouseEnter Event and it actually causes the scroll bar to move on mouse over!
This is most certainly an evil problem haha. I've attached the sample project, just run it and click from grid to grid. Uncomment the MouseEnter code to see the utility function actually causing the scroll.
Thanks:)
BTW, uploading files causes an error when using Google Chrome.
This sounds to me like a very common issue with AutoScroll. The AutoScrolling functionality on a scrollable control automatically scrolls a control into view when it becomes the active control. If the control is larger than the visible area, then it scrolls the upper left corner of the control into view. It sounds like this is what's happening here.
The reason it doesn't happen when you scroll the grid and click on it again is that the grid is already active by that point. You have to click away from the grid and back into it to trigger the automatic scrolling.
Unfortunately, we really have no control over this. It's simply the way scrollable controls work.
There's a way you may be able to work around the issue. There's a property on Control called AutoScrollOffset which allows you to specify an offset into the control to scroll into view. So rather than always scrolling the upper left corner of the control into view, you can sort've tell it that it's already in view and doesn't need scrolling.
The bad news is that this is quite mind-bogglingly complicated because the offset you need will change depending on the current location of the grid, the margins of the scrollable control, and is further complicated by the possibility of nested scrollable controls.
The good news is that we have already written this code and there's a method in Infragistics.Win.Utilities called FocusControlWithoutScrollingIntoView.
So... maybe what you can do is hook the MouseDown event of the grid and call this method, which will give the grid focus without scrolling it into view. Assuming that the MouseDown event fires before the grid has focus, this should mean that the grid will already be activated and no scrolling will actually occur when the grid is already in view and the Scrollable control that contains the grid will not scroll.
I haven't tested this, but it seems like it should work.
Either way, if you want to post your sample here, you can attach a zipped sample application to your post under the Options tab.
Thanks for your reply Mike.
While the bottom row being out view and jumping into to view can be lived with the other problem is much larger.
We have about 10 grids on the screen on top of one another inside of an MDI Container. The form inside the MDI container is set to AutoScrollBar, and is set to Fill. If one of the grids hangs below the bottom of the screen and that grid is not the active selected control, when you click it the "AutoScrollBar" jumps to fit the entire grid on the screen. Also selecting all the rows between the one you click and where the mouse finishes. If you scroll back up, and click the same grid, it does not happen again. I have to click one of the other grids first, then back to the hanging one and it will happen again.
This application is very large and this home screen has a ton going on so I tried to duplicate this in a sample project but I was unable to do so. I assume that this is probably something something somewhere in the code. If you have any clue what could cause this or how I could start to hunt this down it would be much appreciated, otherwise thanks very much for your help thus far.
EDIT: I have created a sample project that duplicates this! How can I get the project to you?
The behavior you are describing is the intended behavior.
If the user clicks on a row that is at the bottom of the grid and the row is not fully visible, it becomes the active row and is scrolled into view. This makes sense, and it would be very unintuitive for it to work any other way.
I understand the issue you are describing, though. If you double-click, the first and second click occur on two different rows in the grid. I'm not sure what you can do about this. If you can detect when this situation occurs, you might be able to cancel the BeforeRowRegionScroll event to work around it. But it really depends on exactly what is happening.
If you can create a small sample project demonstrating the issue, I will be happy to take a look and see if I can find a workaround for you.