#710 – DoDragDrop Is a Blocking Call
December 12, 2012 1 Comment
When you initiate a drag-and-drop operation by callingĀ DragDrop.DoDragDrop, control will not return from theĀ DoDragDrop method until the drag-and-drop operation has completed.
private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DataObject data = new DataObject(DataFormats.Text, ((Label)e.Source).Content); DragDrop.DoDragDrop((DependencyObject)e.Source, data, DragDropEffects.Copy); // Not called until drag-and-drop is done ((Label)e.Source).Content = "DragDrop done"; } private void Label_Drop(object sender, DragEventArgs e) { ((Label)e.Source).Content = (string)e.Data.GetData(DataFormats.Text); }