WPF Reflections

Oct 29 2007   4:28PM GMT

Drag and drop



Posted by: MarkWPF
WPF

If you find yourself needing to do drag and drop in WPF, and don’t want to do anything fancy try looking at Josh Smith’s drag and drop manager – at http://www.codeproject.com/WPF/ListViewDragDropManager.asp

You use it by declaring a private instance of the DragDropManager with the type of your items:

ListViewDragDropManager<MyDataItem> dragManager;

 Them, create it in your loaded event and attach the ProcessDrop event:

dragManager = new ListViewDragDropManager<MyDataItem>(lv, true);
dragManager.ProcessDrop += new EventHandler<ProcessDropEventArgs<MyDataItem>>(dragManager_ProcessDrop);

and away you go

:-)  

Comment on this Post

Leave a comment: