Windows Forms: how to drag and drop a .xml file on a TextBox?
<p>I have a Windows Forms TextBox in which I want to allow the user to drag and drop a file from Windows Explorer.
I would like to allow only for dropping an .xml file (path) on the TextBox.
The way of testing the file format to be dropped, on the DragEnter event, is:</p>

<pre><code>private void DragEnter(object sender, DragEventArgs e)
{
  if (e.Data.GetDataPresent(DataFormats.Text))
    e.Effect = DragDropEffects.Move;
  else
    e.Effect = DragDropEffects.None;
}
</code></pre>

<p>The DataFormats above doesn't contain Xml. If I use DataFormats.FileDrops, I allow any types of files to be dropped, as far as I understood.
Any ideas?
Thanks in advance!</p>
