1

Windows seems to utilize in a few places a more modern dialog for browsing and selecting folders (I found this screenshot online, http://media.wiley.com/Lux/97/145397.image1.jpg), so I'm wondering if there's any way to access that dialog and use it in a program myself.

I, of course, know about System.Windows.Forms.FolderBrowserDialog, but that's still using an old TreeView-esque kind of UI that's not really used any more (for good reason, I fear).

I've seen a few of these kinds of questions (for instance, OpenFileDialog that can select folders?) but they're outdated, refer to third-party dialogs (which I'd rather avoid, if possible), or both.

Am I just missing something? I can imagine this sort of thing being hidden in some other library or API/SDK or something. I'm just surprised that Microsoft seems to be using it so thoroughly throughout Windows without releasing it fully, especially since I've seen it at least since Windows 7.

Matthew Haugen
  • 12,916
  • 5
  • 38
  • 54

1 Answers1

2

That is the Vista version of the OpenFileDialog. The underlying native interface is COM-based, the IFileDialog::SetOpions() method was called with the FOS_PICKFOLDERS option.

This feature is not directly exposed in .NET, it has the burden of still having to support old operating systems that don't support the Vista interface. XP in particular. If you can afford to no longer support XP, or are willing to write the fallback code that still uses FolderBrowserDialog for old operating systems, then you can find code to interop with IFileOpenDialog in the Windows API Code Pack library.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536