更新时间:2023-12-03 13:29:04
尝试以下链接 -
http://msdn.microsoft.com/en-us/library/ms742859.aspx [ ^ ]
在WPF中拖放 [ ^ ]
http:/ /wpftutorial.net/DragAndDrop.html [ ^ ]
Hi,
I try to drag and drop a file from desktop to WPF application. But its not working. I written a code get the drag file like,
if (e.Data.GetDataPresent(DataFormats.FileDrop, true))
{
string[] droppedFilePaths = e.Data.GetData(DataFormats.FileDrop, true) as string[];
}
and also try''d this,
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
// Note that you can have more than one file.
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
// Assuming you have one file that you care about, pass it off to whatever
// handling code you have defined.
}
But both code not working for me. Please help me on this. Thank you.
Try the following links -
http://msdn.microsoft.com/en-us/library/ms742859.aspx[^]
Drag and Drop in WPF[^]
http://wpftutorial.net/DragAndDrop.html[^]