Nam G VU
Nam G VU

Reputation: 35444

How to detect a NOT-possible drag-n-drop in WPF applications?

I see some QnAs in our SO discussing about how to detect a drag-n-drop event but sometimes, for some reason such as application A run with admin right whist application B did not, the drag-n-drop is NOT allowed by Windows OS.

My question is: How can we detect a NOT-possible drag-n-drop happens in our code?

Edit

This question is about drag-n-dropping between two applications, one is privileged (run as admin) and other is NOT. Dragging between them is not allowed by Windows OS. I want to detect that situation and pop up a message in my application to let the users know why dragging then is not possible.

Upvotes: 1

Views: 281

Answers (1)

biju
biju

Reputation: 18040

I guess you can do this using the DragOver event

private void UserControl_DragOver(object sender, DragEventArgs e)
{
  //Verify that this is a valid drop
  if (!Validate())
  {
   e.Effects = DragDropEffects.None;
   e.Handled = true;
  }
}

Upvotes: 2

Related Questions