Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileBrowser/FileSelector for WPF

Does anybody know if there is a WindowsExplorer-like filebrowser which I can include in my WPF-window? I don't want use OpenFileDialog.

I have searched a bit and only found simple directory-trees or lists. I want to have an interface like it is in OpenFileDialog.

I'd be grateful for any assistance,

like image 236
martin Avatar asked Dec 11 '09 16:12

martin


2 Answers

Use System.Windows.Forms.FolderBrowserDialog. Add a reference to System.Windows.Forms, then run the following code:

        string selectedFolder = string.Empty;
        FolderBrowserDialog selectFolderDialog = new FolderBrowserDialog();
        selectFolderDialog.ShowNewFolderButton = true;
        if (selectFolderDialog.ShowDialog() == DialogResult.OK)
        {
            selectedFolder = selectFolderDialog.SelectedPath;
        }

This will work in Windows XP and Vista and you won't need to add any third-party references.

like image 138
Ryan Shripat Avatar answered Nov 15 '22 06:11

Ryan Shripat


I think the new 'CommonOpenFileDialog' is what you want. "Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog" It is part of the win7 code pack, and will be part of .NET4.0 later. Search for CommonOpenFileDialog you can find lot of resources on web.

http://windowsteamblog.com/blogs/developers/archive/2009/04/16/light-up-with-windows-7-libraries.aspx

The code pack can be downloaded here http://code.msdn.microsoft.com/WindowsAPICodePack

like image 37
Jobi Joy Avatar answered Nov 15 '22 07:11

Jobi Joy