WPF: how to make normal listbox left-drag-select behavior use middle mouse instead?

Posted by Scott Bilas on Stack Overflow See other posts from Stack Overflow or by Scott Bilas
Published on 2010-06-08T22:52:36Z Indexed on 2010/06/08 23:12 UTC
Read the original article Hit count: 185

Filed under:

I'm building a special listbox control that our designers want customized in some tweaky ways.

One thing they want to see is that the middle button-drag does what the left button-drag normally does (we are repurposing left-drag to other things).

So it needs the two key features that left-drag does in a ListBox default implementation:

  1. While holding down the button and dragging, the selection starts where I click down and extends to where I drag.
  2. While dragging outside the listbox region, it scrolls if there is scrollable space in that direction.

Before I go an duplicate this functionality by hand, is there any easy way to fool ListBox into thinking it's getting left-mouse drag events but instead is getting middle-mouse?

© Stack Overflow or respective owner

Related posts about wpf