Drag-n-Drop with ListBox

  • Thread starter Jacob W Anderson
  • Start date
J

Jacob W Anderson

Hi all,

I want to setup a drag source in a Windows.Forms.ListBox
control, but I don't see any docs on how to do this.
Unlike the TreeView, the ListBox has no ItemDrag event
handler, so it looks like I have to use the MouseDown
event. Is that correct:

if(_listSpec.SelectedItem != null)
{
DoDragDrop(_listSpec.SelectedItem,
DragDropEffects.Copy);
}

The problem with this model is that in the drag
destination, the drag value is always the first item in
the source list (_listSpec).

Does anybody have some sample code for implementing a
ListBox as a drag source? (in C# preferably)

Thanks

-- Jake
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top