Back to Devexpress

DXFolderBrowserDialog Class

wpf-devexpress-dot-xpf-dot-dialogs-328560b6.md

latest3.9 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Wpf.Dialogs

Declaration

csharp
public class DXFolderBrowserDialog :
    DXCommonDialog,
    IFolderBrowserDialog,
    ICommonDialog,
    IDisposable
vb
Public Class DXFolderBrowserDialog
    Inherits DXCommonDialog
    Implements 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.

csharp
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();
}
vb
Private Sub button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim fileDialog = New DXFolderBrowserDialog()
    fileDialog.Description = "Select the folder you want to open:"
    fileDialog.ShowNewFolderButton = False
    fileDialog.ShowDialog()
End Sub

The image below illustrates the result.

Inheritance

Object CommonDialog DXCommonDialog DXFolderBrowserDialog

See Also

DXFolderBrowserDialog Members

DevExpress.Xpf.Dialogs Namespace