Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Canceling a Drop Event within the Drop Handler
posted

I'm performing Drag & Drop within a XamDataTree where there are "Product" nodes that can contain many "License" nodes. Currently, a user can drag a License to any Product node, but I want to only a allow a user to drag a License node to the correct Product for the license. I'm overriding the DragEnter and Drop events, and I have some custom logic (based on the objects that the tree is bound to) that determines if the drop should be allowed. I know I can set the DragDropCancelEventArgs.Cancel variable to true in the DragEnter event, and this works, but I don't want to completely cancel the operation until the drop is attempted. However, if I call DragDropManager.EndDrag(true) in the Drop event, it does nothing.

Any ideas on how to get this to work?