FileBrowser/FileSelector for WPF
Asked Answered
I

4

6

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,

Incapacitate answered 11/12, 2009 at 16:24 Comment(0)
D
2

It's WinForms, but I've sucessfully used it in WPF applications:

http://gong-shell.sourceforge.net/

(LGPL Licenced)

Dinnerware answered 11/12, 2009 at 17:26 Comment(1)
Can you show an example on how to use it in WPF?Brewing
N
5

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.

Nuno answered 22/9, 2011 at 13:10 Comment(0)
G
3

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

Godspeed answered 11/12, 2009 at 18:25 Comment(1)
the problem i have is, that i need to run my wpf application under windows xp. if i have understood right this solution only runs under windows vista and windows 7Incapacitate
D
2

It's WinForms, but I've sucessfully used it in WPF applications:

http://gong-shell.sourceforge.net/

(LGPL Licenced)

Dinnerware answered 11/12, 2009 at 17:26 Comment(1)
Can you show an example on how to use it in WPF?Brewing
T
-1

I am actually quite new to posting on this site but as Ryan Shripat pointed out; System.Windows.Forms should work.

For files you can use the System.Windows.Forms.OpenFileDialog object.

Thury answered 13/10, 2011 at 13:37 Comment(1)
[quote] I don't want use OpenFileDialog. [/quote] Oops, guess i should have read the question better.Thury

© 2022 - 2024 — McMap. All rights reserved.