private void HandleDrops(System.Windows.Controls.TextBox source, System.Windows.DragEventArgs e) { // Note that you can have more than one file. string[] files = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop); string directory = files[0]; if (File.Exists(files[0])) { directory = Path.GetDirectoryName(files[0]); } if (directory != files[0]) { txtOutput.Text = $"That was a file that you dropped. I can't use that so I selected the path: {directory}"; } source.Content(directory); }