Double-click a folder browser dialog?

D

David Veeneman

I'm trying to implement some fairly standard behavior (or so I thought) on a
FolderBrowserDialog component. double-clicking a folder in the dialog should
have the same effect as selecting the folder and clicking the dialog's OK
button. But the FolderBrowserDialog component doesn't implement that
behavior, and it doesn't have a double-click event that would allow me to
implement it.

Is there a simple way to implement this behavior? Thanks.
 
N

Nicholas Paldino [.NET/C# MVP]

David,

Unfortunately, this isn't made available to you. It's not even
available through the API call SHBrowseForFolder (which is what the
FolderBrowserDialog calls, ultimately). You could try and derive from
FolderBrowserDialog, and replace the hook procedure (HookProc) as well as
the RunDialog procedure and then get the window handle for the tree view,
but that's VERY implementation specific, and I wouldn't depend on it.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

David Veeneman said:
I'm trying to implement some fairly standard behavior (or so I thought) on
a FolderBrowserDialog component. double-clicking a folder in the dialog
should have the same effect as selecting the folder and clicking the
dialog's OK button. But the FolderBrowserDialog component doesn't
implement that behavior, and it doesn't have a double-click event that
would allow me to implement it.

Unfortunatelly that feature is not available, not only that but
FolderBrowserDialog is a sealed class, so you cannot inherit from it.

You either implement your own FolderBrowserDialog from the scratch or look
around for a third party implementation
 
N

Nicholas Paldino [.NET/C# MVP]

That sucks. In that case, the OP should extend CommonDialog and call
SHBrowseForFolder, and try to find the tree view window, or like you said,
get a third party implementation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top