Share via


The middle mouse button

Another input question that comes up a lot is what happened to the third mouse button?  We have MouseLeftButtonDown and MouseRightButtonDown events, but no MouseMiddleButtonDown event.  You can get at the middle button by using the attached event Mouse.MouseDown, which listens to all mouse buttons, and check for args.ChangedButton == MouseButton.Middle.

Okay, so that works, but why didn't we create a MouseMiddleButtonDown event like we did for the others?  Well, because we had to draw the line somewhere.  Some mice today support five buttons (left, middle, right, X1, X2), and at least one company I talk to wants even more.  And not all mice have three buttons, we wanted to make clear to application writers which buttons they can expect on all hardware, and which buttons may not be present.  We were also thinking beyond what we normally consider mice -- a tablet stylus generates mouse input (as well as stylus input), and can do left and right clicks but not middle clicks -- we thought that was a fair compromise for other future input devices as well.

The final possibility, of course, was not doing separate left vs. right events, and have only MouseDown.  We had that a long time ago, it's also what we did in Windows Forms, but we got strong feedback from the Windows User Experience folks about this.  Problem is, a single MouseDown event made it too easy for application authors to accidentally create applications that treat left and right buttons the same -- which is an  inconsistent and undesirable user experience.  And we want a platform where it's easy to do the right thing -- thus separate events for left and right.