How do I know if a drag/drop has been cancelled in WPF
Posted
by Jon Mitchell
on Stack Overflow
See other posts from Stack Overflow
or by Jon Mitchell
Published on 2010-04-07T08:37:05Z
Indexed on
2010/04/07
9:03 UTC
Read the original article
Hit count: 208
wpf
|drag-and-drop
I'm writing a user control in WPF which is based on a ListBox. One of the main pieces of functionality is the ability to reorder the list by dragging the items around. When a user drags an item I change the items Opacity
to 50% and physically move the item in an ObservableCollection
in my ViewModel depending on where the user wants it. On the drop event I change the Opacity
back to 100%.
The problem I've got is that if the user drags the item off my control and drops it somewhere else then I need to change the Opacity
back to 100% and move the item back to where it was when the user started the drag. Is there an event I can handle to capture this action? If not is there any other cunning way to solve this problem?
© Stack Overflow or respective owner