Click here to Skip to main content
13,053,026 members (59,833 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a ListView with DragDrop enabled and some MouseHandlers and a GridView inside:
<ListView AllowDrop="True" 
          ItemsSource="{Binding ...}" 
          SelectedItem="{Binding ...}" 

The ScrollBar of the ListView is visible.
When no item is selected in the listview, everthing works fine.
When an item is selected, i notice this behavior:
I click the scrollbar, when the mouse cursor stays inside the bar, everthing is ok, but when it leaves the bar while the mouse button is still pressed,
the scrollbar loses focus and the drag/drop operation which is implemented in MouseMove Handler is executed.

I do not know why the scrollbar loses focus, has anyone an idea?
Posted 29-Aug-12 3:45am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You have answered your own question ; you are outside of the scrollbar hover over the listview enables the drag and drop. You will need to handle this behavior in your code . You basically will need to ensure that once the mouse is pressed on the scroll bar , it is the control with focus even on a mouse move,
You may get around the behavior by removing your drag and drop event momentarily DragDropEvents -= (DragDropHandler); then renable them after the scroll bar has been let go.

OnMouseMove event is something like my MouseScrollBarSelected - don't drag and drop, (remove the handler) MouseScrollBarUnSelected reenable my DragDropEvent,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 2 Nov 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100