Does this enable a way of letting people choose folders rather than
files? I'd like something that works just like an OpenFileDialog but
allows choosing a folder as an alternative to choosing a file.
(FolderBrowserDialog is rather clunky by comparison.)
In either WPF or WinForms.
Thanks to anyone with useful thoughts to contribute.
> (FolderBrowserDialog is rather clunky by comparison.)
Really? I've always thought that the folder browser was much more elegant
than the Open dialog for picking a folder. Using the latter always felt like
a kludge to me. Oh well, to each his own.
> I've just been looking at OpenFileDialog's HookProc...
>
> Does this enable a way of letting people choose folders rather than
> files?
No. I admit, I'm not even sure why they bothered to document it.
OpenFileDialog is sealed and HookProc is protected. There's no way to
call it from client code, never mind override it.
If you want to be able to select folders from the OpenFileDialog, I think
your best bet is to just use the native common dialogs directly, either
via p/invoke or with your own managed C++ wrapper. I'm sure there's a way
to hack the OpenFileDialog class itself, but I can't imagine that would be
less work and/or more reliable than just going to the native API directly.
Pete
My recollection is that FolderBrowserDialog doesn't see or follow links.
Is that right?
There us a sample which shows how to use CaOpenFileDialog component
for folder selection.
Hope this helps.
Alex