WPF TreeView drag and drop using preview

Posted by imekon on Stack Overflow See other posts from Stack Overflow or by imekon
Published on 2010-06-05T07:03:12Z Indexed on 2010/06/05 7:12 UTC
Read the original article Hit count: 697

Filed under:
|
|
|
|

I'm handling drag and drop events in a TreeView using PreviewMouseDown, PreviewMouseMove and PreviewMouseUp, however, there is an issue.

In my PreviewMouseDown handler, I set everything ready in case there's a drag started (detected in the Move event), however I set e.Handled = true. This means that standard selection events don't get generated on my tree!

What I want to be able to do in my Up event is to invoke the standard treeview selection changed event - except I cannot call events outside of the tree. So what's the correct way to do this?

I have tried using the standard MouseDown, MouseMove and MouseUp events however there's an issue with messing up my multiple selection feature that means I need to use the Preview version of those events.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf