You'll need to handle the
DragDrop.DragOver attached event[
^] and set the
Effects
property on the
DragEventArgs
parameter to an appropriate value based on the available data formats.
private void control_DragOver(object sender, DragEventArgs e)
{
e.Effects = DragDropEffects.None;
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effects = DragDropEffects.Copy;
}
}
private void control_Drop(object sender, DragEventArgs e)
{
string[] droppedFiles = e.Data.GetData(DataFormats.FileDrop) as string[];
if (droppedFiles != null && droppedFiles.Length != 0)
{
...
}
}
Drag and Drop Overview[
^]
I haven't used it, but I've just found
this WPF drag/drop library[
^], which looks promising.