A "solution" without external packages, without rolling your own control and without P/Invoke-stuff, but more of a horrible workaround:
//using System.Windows.Forms;
OpenFileDialog ofp = new OpenFileDialog();
ofp.FileName = "The file will be ignored";
ofp.CheckFileExists = false;
ofp.CheckPathExists = true;
ofp.ValidateNames = false;
Simply put, a non-existing file with the name The file will be ignored
will be selected from the dialog. As CheckFileExists
is false, this won't be a problem and you can just read the chosen directory.
In other words: the user can select any file he/she wants.
I don't recommend using this. It's quite horrible (in style and for the user), but this is the most simple way to achieve what you want. Personally, I would go all the way and implement my own control or - even better - use a third-party control. There are a few out there who do this.
There is no support for this out-of-the-box. With the standard dialogs you can either see files, but not select folders or the other way round.