All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

DXOpenFolderDialogService Class

Represents a dialog box that allows end-users to specify folder names for one or more folders to open.

Namespace: DevExpress.Xpf.Dialogs

Assembly: DevExpress.Xpf.Dialogs.v20.1.dll

Declaration

public class DXOpenFolderDialogService :
    FileDialogServiceBase,
    IOpenFolderDialogService,
    IOpenDialogServiceBase,
    IFileDialogServiceBase
Public Class DXOpenFolderDialogService
    Inherits FileDialogServiceBase
    Implements IOpenFolderDialogService,
               IOpenDialogServiceBase,
               IFileDialogServiceBase

Remarks

The DXOpenFolderDialogService provides the standard open folder dialog functionality and supports DevExpress theming mechanism that allows your applications to look consistent.

The DXOpenFolderDialogService enables users to browse, create, and select folders in the File System by using the DXOpenFileDialog dialog.

The DXOpenFolderDialogService implements the IOpenFolderDialogService interface.

DXOpenFolderDialogService

How to Use

To use the DXOpenFolderDialogService service, attach it to your View via the Interaction.Behaviors collection.

<UserControl x:Class="FolderBrowserDialogServiceSample.Views.FolderBrowserDialogView"
    ...
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
    xmlns:dxdlg="http://schemas.devexpress.com/winfx/2008/xaml/dialogs">
    <dxmvvm:Interaction.Behaviors>
        <dxdlg:DXOpenFolderDialogService />
    </dxmvvm:Interaction.Behaviors>
    ...
</UserControl>

Then, access the attached service by using one of approaches described in Services in POCO objects or Services in ViewModelBase descendants topics and invoke its IOpenFolderDialogService.ShowDialog method to show the open folder dialog.

public class OpenFolderDialogViewModel {
    public virtual string SelectedFolder { get; protected set; }
    public void ShowDialog() {
        IOpenFolderDialogService service = this.GetService<IOpenFolderDialogService>();
        if (service.ShowDialog(null, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))) {
            // The selected folder path
            SelectedFolder = service.Folder.Path;
        }
        return;
    }
}

To select a folder, a user should select an item and press the Open button. When the dialog box is closed and the ShowDialog returns true, the IOpenFolderDialogService.Folder is set to an IFolderInfo object that contains information about the selected folder.

If you want to provide the user the ability to select a file instead of a folder, use the DXOpenFileDialogService instead.

Inheritance

Object
DispatcherObject
DependencyObject
Freezable
Animatable
DevExpress.Mvvm.UI.Interactivity.AttachableObjectBase
DevExpress.Mvvm.UI.Interactivity.Behavior
DevExpress.Mvvm.UI.Interactivity.Behavior<FrameworkElement>
DevExpress.Mvvm.UI.ServiceBaseGeneric<FrameworkElement>
ServiceBase
DevExpress.Mvvm.UI.WindowAwareServiceBase
DevExpress.Mvvm.UI.FileDialogServiceBase
DXOpenFolderDialogService
See Also