12

I have this WPF app and I want to have there function of getting a directory path from the user. I would like to use some folder browser dialog but I don't want to implement it from System.Windows.Forms or use some huge script inside. Is there some path getting dialog in WPF already implemented?

I have read answers to similar questions here but it was full of System.Windows.Forms..

I haven't found anything like that in the Toolbox and I'm starting with WPF so I could use some help.

Thank you in advance :]

C. Augusto Proiete
  • 24,684
  • 2
  • 63
  • 91
Ms. Nobody
  • 1,219
  • 3
  • 14
  • 34
  • What's the problem with System.Windows.Forms (used from WPF) ? – H H Apr 30 '13 at 16:24
  • @HenkHolterman Is there no down side to using System.Windows.Forms? – paparazzo Apr 30 '13 at 16:30
  • 1
    @HenkHolterman It just feels weird making WPF app so I wont make the Windows Form app and then use stuff from it there :| – Ms. Nobody Apr 30 '13 at 16:32
  • You don't have to make a WinForms app... just borrow a few classes. @Blam: No , not really. – H H Apr 30 '13 at 16:35
  • 1
    @HenkHolterman I know, I know.. just thought that WPF will have covered the things that are in WinForms. Not to take them from there, but ok. Was just curious if it really isn't there somewhere and I just can't see it. – Ms. Nobody Apr 30 '13 at 16:42
  • 3
    @goodfriend You are not alone on this. I always find it weird everytime I have to reference Windows forms to use the dialogs. I dont understand why WPF does not have their own? Plus I never really liked the FolderBrowserDialog to begin with. – MisterXero Apr 30 '13 at 21:32
  • One concrete problem with the WinForms dialog is you can't parent it. We use parenting to enable programmatic dismissal of modal dialogs. – Jeff Kotula Aug 28 '15 at 14:24
  • Have you tried the [Ookii Dialogs for WPF](https://github.com/caioproiete/ookii-dialogs-wpf)? – C. Augusto Proiete Oct 04 '18 at 03:03

4 Answers4

12

See my answer to Select folder dialog WPF. Basically the Windows Presentation Foundation 4.5 Cookbook recommends that you use the Windows® API Code Pack for Microsoft® .NET Framework if you need a folder browser.

Community
  • 1
  • 1
T Powers
  • 1,637
  • 3
  • 13
  • 11
  • The Windows API Code Packs are available via Nuget [here](http://www.nuget.org/packages/Windows7APICodePack-Shell/) and [here](https://www.nuget.org/packages/Windows7APICodePack-Core/). This worked well for me. – Wallace Kelly Oct 09 '13 at 16:06
8

we use Ookii Dialogs in our projects. They have the windows-look and feel and the typical options for filtering etc.

Bernhard Krenz
  • 279
  • 1
  • 4
  • Here's a link to an updated [Ookii Dialogs for WPF](https://github.com/caioproiete/ookii-dialogs-wpf) targetting .NET 4.5 and [available on NuGet](https://www.nuget.org/packages/Ookii.Dialogs.Wpf/) – C. Augusto Proiete Oct 04 '18 at 03:06
3

There are no standard native WPF dialogs for what you are looking for, simply because the System.Windows.Forms dialogs are nothing more than wrappers to the system ones. So creating a WPF wrapper makes no sense and will only add to the confusion.

  • 19
    No; what makes no sense is a UI framework which lacks such basic constructs. No folder browser dialog? No numeric updown? Give me a break. – Ed S. Jan 29 '15 at 00:29
0

The Ookii Dialogs for WPF library has a VistaFolderBrowserDialog class that provides a complete implementation of a folder browser dialog for WPF.

https://github.com/augustoproiete/ookii-dialogs-wpf

Ookii Folder Browser Dialog

There's also a version compatible with Windows Forms apps

C. Augusto Proiete
  • 24,684
  • 2
  • 63
  • 91