Use OpenFileDialog and FileBrowserDialog in WPF

WPF does not contain a OpenFileDialog or FileBrowserDialog. Nevertheless, I needed them in a WPF application.

Searching the web, I found several approaches. One published on GitHub (https://github.com/tillias/wpFolderPicker) implements a new control for folder browsing. But I wanted a “cheap” solution. And found the starting point here: WPF OpenFileDialog and FolderBrowserDialog.

Ben suggested to add WindowsFormsIntegration to the project’s references. That did not worked for me (.NET 4.5, VS 2012). But adding System.Windows.Forms to the references and using statements made the OpenFileDialog and FileBrowserDialog working in my WPF application 🙂