Friday, February 18, 2011

FolderBrowserDialogEx - A C# Wrapper for SHBrowseForFolder

CodeProject - FolderBrowserDialogEx: A C# customization of FolderBrowserDialog


We've all used FolderBrowserDialog and its precursor SHBrowseForFolder. While these common controls are very useful in stock form, they never quite seem to do exactly what you want - there's always some UI artifact that you really don't want. And, like many things in .NET, the managed API seems to be a thin wrapper around the unmanaged API, and the managed API therefore inherits all the quirks.

I had a few gripes about FolderBrowserDialog, especially:

  • The stock "Browse For Folder" dialog title... I want to say something more informative.
  • There's no option for a path edit box... it's in SHBrowseForFolder but disappeared in FolderBrowserDialog.


Here's a snap of the sample app;




I REALLY like have the Folder edit/textbox on my Folder Browser dialogs. All to often I have a folder path already on the clipboard and waiting to be pasted when I run into this dialog. And in most cases, there's no folder textbox, so I have to click my way to the given folder... (grumbling the whole way)

Needless to say, when I saw this CodeProject I wanted to be sure to capture it here in my remote, cloud based, full text searchable memory store... ;)

1 comment:

tomexou said...

FolderBrowseDialog is a terrible UI via TreeView interface. I prefer use "OpenFileDialog" UI to select a folder. But not found in this world.