Search code examples
.netwpfscrollscrollwheel

Scroll wheel bugged in WPF applications


I have an issue that on one computer applications developed using the Windows Presentation Foundation have my scrollwheel all inverted. I scroll 'upwards' and the control in question will go down. And vice versa. Other programs are not affected and scroll just fine.

I have searched a lot, but I can't seem to figure out what might be causing it. I am using W7 64-bit.

Things I have tried or might be useful to know...

  • creating an application using Winforms as well as a plain Win32 api. In those, when I scroll down, it scrolls down. All is well there.
  • I have also tried one of the affected applications (which I myself wrote) on my WXP 32-bit laptop. On that one, scrolling down indeed means scrolling down.
  • I use the standard Windows mouse driver. No fancy Logitech or other software installed that might be causing this.
  • This Windows installation is 2 months old or so. There is very little, if no cruft. I have no doubt that if I reinstalled, I'd manage to trigger it again. (I never had this issue before because prior to this I ran XP and avoided .NET like the plague.)

Anyone have any clue what setting is hiding where that's messing my WPF applications up like this?

Edit:

The following, when put on a populated listview, gives the correct message (down for down scroll, up for up scroll), yet it will still scroll in the wrong direction. What the hell?

private void listView1_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
    if (e.Delta < 0)
        textBox1.Text = "PREVIEW DOWN WE GO.";   // no we end up going up :(
    else
        textBox1.Text = "PREVIEW UP UP UP.";     // big letdown here.
}

(The plain MouseWheel event won't fire, hence the preview variety.)


Solution

  • Holy crap, I just figured it out. It suddenly hit me.

    I have me Mouse wheel set to 'scroll one screen at a time'. I never thought anything of it despite going over that window a dozen times looking for an 'invert scroll direction' option I might have checked.

    Setting the setting to scroll a given number of lines per notch on my wheel fixes the scrolling, although I don't get my expected paging.

    This is plain buggy coding on Microsoft's part. First I spend half a day searching the internet for TextOptions.TextFormattingMode="Display" so my forms don't look like total crap, then I spend a small eternity on another issue which thankfully had a simple setting suffice as well. And now this. Am I just hitting all those little roadbumps nobody else seems to hit or care much about? :/

    (Apologies for answering my own question again, kind people. I've done it the last few questions despite searching for answers on the matter for hours. Ugh.)