I have a listview control, in detail mode, and I am trying to implement
Drag-and-drop from it.
If I click on an item, I can then re-click and drag it, but if I just click
and drag, it doesn't work, because the item I clicked isn't selected until
the mouse-up event.
I tried turning on "hover selection" on the control, and it works to an
extent, but seems slow to keep up with the mouse, so often you don't then
drag the correct item.
What am I doing wrong? Should I not be accessing the selecteditems
collection for this?
Code snippet:
private void lstExcelHeaders_MouseDown(object sender, MouseEventArgs e)
{
if (lstExcelHeaders.SelectedItems.Count != 0)
{
lstExcelHeaders.DoDragDrop(lstExcelHeaders.SelectedItems[0].Text,
DragDropEffects.All);
}
}
Jeff Gaines - 15 Dec 2006 13:10 GMT
On 15/12/2006 in message <#mSBibEIHHA.1064@TK2MSFTNGP04.phx.gbl> james
wrote:
>I have a listview control, in detail mode, and I am trying to implement
>Drag-and-drop from it.
[quoted text clipped - 17 lines]
> }
>}
Can you not use the standard ItemDrag function that is built in to a
ListView?

Signature
Jeff Gaines
Damerham Hampshire UK
james - 15 Dec 2006 15:00 GMT
> On 15/12/2006 in message <#mSBibEIHHA.1064@TK2MSFTNGP04.phx.gbl> james
> wrote:
[quoted text clipped - 6 lines]
> Can you not use the standard ItemDrag function that is built in to a
> ListView?
Ah, that seems better.
Didn't know that was there (serves me right for mindlessly following
examples on the net!)