Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,


I am making a WPF application , in which i have a datagrid which contains list of employees.

On the left of window i have a treeview which shows all departments & subdepartments.

What i want is that i select a employee / row in datagrid and drag it over to the specific node of treeview and finally i get the data of row/rows i selected so that i could move them to selected department. But i am unable to get logic on how to do drag n drop in WPF datagrid. Please help
Posted

Drag & Drop in WPF an MVVM can be hard to do.
I use this library GongSolutions.Wpf.DragDrop library[^] it is nice and easy to work with.
Give it a try, you can find it on NuGet https://www.nuget.org/packages/gong-wpf-dragdrop/[^]

It will work on any WPF control that has bind an ItemSource to a collection.

Some good examples:

Drag and Drop in WPF[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900