We have a fairly large datagrid with ~30 columns, and thousands of rows.
When the user grabs the scrollbar with the mouse button and scrolls up/down, the grid performs well and scrolling is fast enough.
When the user instead uses the mouse wheel to scroll up and down, performance is good on small scroll movements. However, on large movements, the grid just freezes up for a few seconds, providing a poor user experience.
We've attached the following to the MouseWheel event on the grid:
void LayoutUltraGrid_MouseWheel(object sender, MouseEventArgs e)
{
Debug.WriteLine("MouseWheel Delta: " + e.Delta);
}
And have noticed on small deltas (+/-120) we get good performance. On large deltas (i.e. when the user attempts to scroll a long distance rapidly the rolling the wheel quickly), for example +/-960, we get the freeze-up.
Is there a way to improve this situation? Perhaps by filtering out the large deltas and restricting only small deltas to be processed? We think that may solve our problem but are wondering if the grid makes it easy to support such an approach using the provided API.
The best solution we have found so far is to inherit the grid and override OnMouseWheel, and filtering out large scrolls and instead replacing them with page up/down scrolling, which gives a more responsive user interface that doesn't freeze-up.
Hello gsharm3,
I created the following case for you: 'CAS-91735-CQN0M7' and will update you through it.
110635, Grid Slow scrolling performance when using the mouse wheel, 11.2.20112.2078, 12.1.20121.2012
This issue was supposed to be resolved in the above service released, but we're using service release 12.1.2012.2024 and .2054 we STILL see this issue. Using the scroll wheel kills performance and CPU.
Hi,
The issue that was fixed was very specific - it had to do with fixed headers in the grid. It didn't have anything specifically do to with the mouse wheel, either, it occurred even when scrolling via the keyboard. That issue is definitely fixed.
So my guess is that whatever issue you are experiencing is probably a different issue. Can you post a small sample project demonstrating the issue you are having?
It's as described in the first post. Only a few 100 rows. LoadOnDemand with a datasource CellDataRequested. Dragging the thumb, paging, or arrow keys is real time fast. But use the mouse wheel for large deltas and the grid will freeze for several seconds until it catches up. Small delta is ok. It only happens with a bigger delta. I worked around it as the prevoius poster suggested by overriding the OnMouseWheel:
protected override void OnMouseWheel(MouseEventArgs e) { if (e.Delta > this.Rows.VisibleRowCount) this.DisplayLayout.RowScrollRegions[0].Scroll(RowScrollAction.PageUp);
else if (Math.Abs(e.Delta) > this.Rows.VisibleRowCount) this.DisplayLayout.RowScrollRegions[0].Scroll(RowScrollAction.PageDown);
else base.OnMouseWheel(e); }
I took another look and the bug number you listed here (110635) is not associated with the case that resulted from this issue. So the fix for 110635 has nothing to do with this.
The case listed here was closed after repeated attempts to duplicate the issue in-house were unsuccessful. So as far as I know, we have never been able to duplicate this issue. If you could post a sample project demonstrating the problem, we will certainly look into it, but without a sample, there's nothing we can do. We cannot fix a problem we cannot see and are not experiencing.