Tom Bushell
Tom Bushell

Reputation: 5875

How can I set the focus for a DevExpress XtraGrid so the mouse wheel works right away?

The UI for my WinForms app is centered around a DevExpress XtraGrid.

Usually, the first thing a user wants to do is scroll the grid, so the normal instinct is to move the mouse wheel.

But currently, you have to click a row in the grid first, which is annoying.

I tried to use BaseView.Focus method, but this did not work - still had to click a row before the wheel would work.

Any suggestions on how to accomplish this?

Upvotes: 2

Views: 5097

Answers (1)

DevExpress Team
DevExpress Team

Reputation: 11376

By default, the Grid is scrolled by mouse wheel only if the mouse pointer is above the grid. So, an attempt to focus it does not help. To change this behavior, you should change the static SmartMouseWheelProcessing property in the form's constructor as shown below:

DevExpress.XtraEditors.Drawing.MouseWheelHelper.SmartMouseWheelProcessing = false;

Upvotes: 2

Related Questions