I want to show a dialog (like as OpenFileDialog) to browse for folders and also the files. My windows-forms app is to auto-rename image files in a folder (and optionally all sub folders in it). When user want to select the path, he or she may choose the first file in a folder, OR, choose a parent folder to process all files in that folder and sub-folders.
It is important to see the files in each folder such that user can ensure the proper folder is chosen. It would be nice to be able to see image thumbnails as we can do by OpenFileDialog
in .Net.
There are several questions in SO (like this and this) but none of them work completely as described above! What I have tested:
- The built in
OpenFileDialog
does not let to select a folder. There is some tricky hack that suggest setting theFileName
to something like as "Folder Selection." or "Select..." before callingShowDialog()
method. It works in some scenarios but it has some buggy behavior (at least in Windows 10) for example if user press the back or up buttons (or choose one of mid folders from the path bar at top), the new location can't be chosen by pressing the Open button. - The
WindowsAPICodePack
(andCommonOpenFileDialog
described in this answer) does not show files whenIsFolderPicker
is set to true . - The
Ookii.Dialogs
(VistaFolderBrowserDialog
) does not show files when browsing folders.