How to drag and drop list view items from one app to another?
There is one win forms application wi开发者_开发知识库th some list view items. I'd like to drag several selected items from that app to my another win forms app. Each list view item should contain some custom data and recieving app needs to get it also.
For a lengthy example, see MSDN, Control.DoDragDrop Method. Important for your specific task is
- Call
yourDragSourceControl.DoDragDrop(data, effects)
with the data you want to transfer to the drop target. You can specify any serializable object or a string. - You deserialize the transferred data in the handler of the DragDrop event of the drop target; use
var data = (YourDTO)e.Data.GetData(typeof(YourDTO));
精彩评论