WPF - Drag from withing DataTemplate

Posted by Gustavo Cavalcanti on Stack Overflow See other posts from Stack Overflow or by Gustavo Cavalcanti
Published on 2009-05-29T00:00:56Z Indexed on 2011/01/16 1:53 UTC
Read the original article Hit count: 465

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!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about listbox