WPF - Drag from withing DataTemplate
- by Gustavo Cavalcanti
I have a ListBox displaying employees with a DataTemplate - it looks very similar to this screenshot. I want to be able to click on the employee photo, drag it and drop it somewhere out of the ListBox. How can I do that? I am not sure how to capture the PreviewMouseLeftButtonDown event of the Image, since it's inside the DataTemplate.
Edit: The DataTemplate lives in a separate assembly and the drag/drop logic needs to be in the Window that has the ListBox.
Edit2: I am thinking that the right way of doing this is using commands, am I right?
Thanks!