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.v24.2.dll
NuGet Package: DevExpress.Wpf.Dialogs
#Declaration
public class DXOpenFolderDialogService :
FileDialogServiceBase,
IOpenFolderDialogService,
IOpenDialogServiceBase,
IFileDialogServiceBase
#Remarks
The DXOpenFolderDialogService
delivers the standard open folder dialog functionality and supports DevExpress theming mechanism that allows your WPF applications to look consistent.
The DXOpenFolderDialogService
implements the IOpenFolderDialogService interface. Users can use the DXOpenFileDialog dialog to browse, create, and select folders in the File System:
To use the DXOpenFolderDialogService
service, attach the service to a View using 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>
Access the attached service using one of approaches described in Services in POCO objects and Services in ViewModelBase descendants help topics. Call the 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.
Tip
Use the DXOpen