WPF cancel drag operation

How can i cancel a current drag operation? I want to use the escape key to cancel running drag operations.

Ive looked at the DragDrop class, but cant see anything that would achieve something like DragDrop.Cancel. Any ideas?


I solved the cancelling operation using the following:

On the Control performing the drag (DataGrid in my case) I added a handler for the QueryContinueDrag event.

private void DataGrid_QueryContinueDrag(object sender,
                                        QueryContinueDragEventArgs e)
    if (... condition ...)
        e.Action = DragAction.Cancel;

The condition in your case would be Keyboard.IsKeyDown(Key.Escape).

Need Your Help

Linking to a static lib that links to a static lib

.net c++ .net-2.0

I have a (managed/unmanaged C++) winforms app that links to a static library. That library links to another static library. When I do a Rebuild on the Winforms project, Visual Studio 2005 attempts to

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.