Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DXFolderBrowserDialog Class

Represents a dialog box that allows end-users to browse and select a particular folder.

Namespace: DevExpress.Xpf.Dialogs

Assembly: DevExpress.Xpf.Dialogs.v24.2.dll

NuGet Package: DevExpress.Wpf.Dialogs

#Declaration

public class DXFolderBrowserDialog :
    DXCommonDialog,
    IFolderBrowserDialog,
    ICommonDialog,
    IDisposable

#Remarks

The DXFolderBrowserDialog provides a way to prompt an end-user to browse, create, and eventually select a folder. Use this dialog when you only want to allow the user to select folders, not files. Browsing of the folders is done through a tree control. Only folders from the file system can be selected; virtual folders (like the folders in Control Panel) cannot.

Tip

You can use the DXOpenFileDialog with the DXOpenFileDialog.OpenFileDialogMode set to OpenFileDialogMode.Folders to allow end-users to select a particular folder.

Root folder

Provide the DXFolderBrowserDialog.RootFolder property to make end-users start navigation from a particular folder (any of the Environment.SpecialFolder).

Default folder

Set the DXFolderBrowserDialog.SelectedPath to an absolute path of a subfolder of DXFolderBrowserDialog.RootFolder that will initially be selected.

Custom description

The DXFolderBrowserDialog.Description property allows you to provide a prompt description displayed above the folder hierarchy.

Creating new folders with the DXFolderBrowserDialog

Use the DXFolderBrowserDialog.ShowNewFolderButton property to control if an end-user is able to create new folders with the Make New Folder button.

The code sample below demonstrates how to display a DXFolderBrowserDialog with a custom description and hidden Make New Folder button.

private void button_Click(object sender, RoutedEventArgs e) {
    var fileDialog = new DXFolderBrowserDialog();
    fileDialog.Description = "Select the folder you want to open:";
    fileDialog.ShowNewFolderButton = false;
    fileDialog.ShowDialog();
}

The image below illustrates the result.

DXFolderBrowserDialog.png

#Inheritance

See Also