This documentation is archived and is not being maintained.

FileDialog Class

An abstract base class that encapsulates functionality that is common to file dialogs, including OpenFileDialog and SaveFileDialog.

Namespace:  Microsoft.Win32
Assembly:  PresentationFramework (in PresentationFramework.dll)

public abstract class FileDialog : CommonDialog

The FileDialog type exposes the following members.

Protected methodFileDialogInitializes a new instance of the FileDialog class.

Public propertyAddExtensionGets or sets a value indicating whether a file dialog automatically adds an extension to a file name if the user omits an extension.
Public propertyCheckFileExistsGets or sets a value indicating whether a file dialog displays a warning if the user specifies a file name that does not exist.
Public propertyCheckPathExistsGets or sets a value that specifies whether warnings are displayed if the user types invalid paths and file names.
Public propertyCustomPlacesGets or sets the list of custom places for file dialog boxes.
Public propertyDefaultExtGets or sets a value that specifies the default extension string to use to filter the list of files that are displayed.
Public propertyDereferenceLinksGets or sets a value indicating whether a file dialog returns either the location of the file referenced by a shortcut or the location of the shortcut file (.lnk).
Public propertyFileNameGets or sets a string containing the full path of the file selected in a file dialog.
Public propertyFileNamesGets an array that contains one file name for each selected file.
Public propertyFilterGets or sets the filter string that determines what types of files are displayed from either the OpenFileDialog or SaveFileDialog.
Public propertyFilterIndexGets or sets the index of the filter currently selected in a file dialog.
Public propertyInitialDirectoryGets or sets the initial directory that is displayed by a file dialog.
Protected propertyOptionsGets the Win32 common file dialog flags that are used by file dialogs for initialization.
Public propertyRestoreDirectoryThis property is not implemented.
Public propertySafeFileNameGets a string that only contains the file name for the selected file.
Public propertySafeFileNamesGets an array that contains one safe file name for each selected file.
Public propertyTagGets or sets an object associated with the dialog. This provides the ability to attach an arbitrary object to the dialog. (Inherited from CommonDialog.)
Public propertyTitleGets or sets the text that appears in the title bar of a file dialog.
Public propertyValidateNamesGets or sets a value indicating whether the dialog accepts only valid Win32 file names.

Protected methodCheckPermissionsToShowDialogDetermines whether sufficient permissions for displaying a dialog exist. (Inherited from CommonDialog.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodHookProcDefines the common file dialog hook procedure that is overridden to add common functionality to a file dialog. (Overrides CommonDialog.HookProc(IntPtr, Int32, IntPtr, IntPtr).)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnFileOkRaises the FileOk event.
Public methodResetSets all properties of a file dialog back to their initial values. (Overrides CommonDialog.Reset().)
Protected methodRunDialogRunDialog is called to display a file dialog in a derived class, such as OpenFileDialog and SaveFileDialog. (Overrides CommonDialog.RunDialog(IntPtr).)
Public methodShowDialog()Displays a common dialog. (Inherited from CommonDialog.)
Public methodShowDialog(Window)Displays a common dialog. (Inherited from CommonDialog.)
Public methodToStringReturns a string that represents a file dialog. (Overrides Object.ToString().)

Public eventFileOkOccurs when the user selects a file name by either clicking the Open button of the OpenFileDialog or the Save button of the SaveFileDialog.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.