tags:

views:

537

answers:

4

Possible Duplicate:
C# OpenFileDialog Non-Modal possible

I am working on a C# Windows Form project. While an open file dialog is up I am not able to select anything around it in the GUI. Is there any way to have the openfile dialog open and still be able to select other controls on the main ui?

A: 

You can always roll your own control if you want.

Ramesh
A: 

dban,

The OpenFileDialog class does not support the Show method which will open a form in a modeless state, that is, not locking out the parent.

As far as i know the only way to open the file dialog is like this, and it is modal. The ShowDialog method open forms as modal.

OpenFileDialog dlg = new OpenFileDialog(); dlg.ShowDialog();

You could write your own open file dialog class if you want it to be open non-modally.

But you should also consider whether this is really necessary or not. Typically when a user is presented with a file open dialog it is because the application needs a file. There is nothing else the user should be doing with the app in the mean time.

Paul Sasik
+2  A: 

There is no way to do this with the standard OpenFileDialog. You'd need to make your own, using a Form instead of a FileDialog as the base class. This would let you design your own version that was non-modal.

That being said, I'd recommend against this. File dialogs, in Windows, are modal by default. People expect this behavior from your application - so changing it will only lead to confusion and problems. This tends to make your application less usable and more complicated to end users, even though it often seems like a good idea.

Reed Copsey
+1  A: 

The common dialogs are modal dialogs, which by definition do not allow interaction with any other window in the process while they are active. So the answer to your question is no, there isn't any way to do that. You would have to roll your own dialog using third party or self created controls to interact with the file system -- not a trivial task.

Michael McCloskey