C# - WPF - getting folder browser dialog without using System.Windows.Forms?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 17:21:07

问题


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 :]


回答1:


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.




回答2:


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




回答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.




回答4:


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/caioproiete/ookii-dialogs-wpf

There's also a version compatible with Windows Forms apps



来源:https://stackoverflow.com/questions/16304523/c-sharp-wpf-getting-folder-browser-dialog-without-using-system-windows-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!