public MainWindow()
{
InitializeComponent();
TextBox1.AllowDrop = true;
TextBox1.PreviewDragEnter += TextBox1_DragEnter;
}
private void TextBox1_DragEnter(object sender, DragEventArgs e)
{
Label1.Content = string.Empty;
if (e.Data.GetDataPresent(DataFormats.FileDrop, true))
{
string[] filenames = (string[])e.Data.GetData(DataFormats.FileDrop, true);
foreach (string filename in filenames)
{
Label1.Content += filename + " ";
}
}
e.Effects = DragDropEffects.All;
e.Handled = true;
}