DoubleClick Event not firing when DragDrop code implemented (ListView)

As the subject describes, once I implemented support for DragDrop – The DoubleClick event of the ListView control no longer fires.

An overview of the code is as follows:

PrivateSub ListView_MouseMove(ByVal sender AsObjectByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView.MouseMove  
‘Allow the operation for the Left Mouse Button only
If e.Button = Windows.Forms.MouseButtons.Left Then
‘Verify at least one ListViewItem is selected
If ListView.SelectedItems.Count > 0 Then
‘Confirm the data in the listview can be dragged
If ListView.Columns.Count > 1 Then
‘Create an array of GUIDs based on the selected items
Dim nArr(ListView.SelectedItems.Count – 1) As Guid  
For i AsInteger = 0 To ListView.SelectedItems.Count – 1  
                        nArr(i) = New Guid(ListView.SelectedItems(i).Tag.ToString)  
Next
‘Begin Drag and Drop Operation
                    ListView.DoDragDrop(nArr, DragDropEffects.Move)  
EndIf
EndIf
EndIf
EndSub

Upon Double-Clicking a ListViewItem, the above event is fired instead of the DoubleClick event.

Any *simple* solution is greatly appreciated – I know I can repair it by handling the Click event, storing the time & position of the mouse, and then executing code when a DoubleClick occurs – But that seems a bit much for this!

Many thanks,

Daniel Davies


I’ve never picked up a programming book or attended a class.

Ok – So apparently I cannot even store the time & position of the mouse click, then check it for a Double Click. The Click event fires just once during a Double Click.So I’m open to any suggestion!I’ve never picked up a programming book or attended a class./

Worked around it~PublicClass X   Private _LastClickDate AsDate = Now  Private _LastMousePos As Point = New Point(0, 0)  PrivateSub ListView_MouseDown(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView.MouseDown          _LastClickDate = Now          _LastMousePos = New Point(e.X, e.Y)  EndSubPrivateSub ListView_MouseMove(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView.MouseMove  ‘Allow the operation for the Left Mouse Button only If e.Button = Windows.Forms.MouseButtons.Left Then’Verify at least one object is selected If ListView.SelectedItems.Count > 0 Then’See if the mouse was clicked within 0.5 seconds Dim TicksPassed AsDouble = (Now.Ticks – _LastClickDate.Ticks) / 10000  If (TicksPassed <= 500) And (e.X = _LastMousePos.X) And (e.Y = _LastMousePos.Y) Then'Execute the Double Click Sub                         ListView_DoubleClick()  Else'Begin Drag and Drop Operation                         ListView.DoDragDrop(DataToDragDrop, DragDropEffects.Move)  EndIfEndIfEndIfEndIfEndSubEndClassI've never picked up a programming book or attended a class.

As i am working with a project which really needs a image in xaml window to drag from one position to other using multipoint mouse. There is no supported event for this image control in wpf for MultipointMouseLeftButtonDownEvent.Without this i can’t proceed  with my project. Am using Multipoint Mouse SDK and visual c# 2010.So please help me solve this prob.i have tried in google i didn’t find a proper solution for this.thanks in advance.