C# - WPF - 在不使用System.Windows.Forms的情况下获取文件夹浏览器对话框?

时间:2021-01-07 20:37:31

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?

我有这个WPF应用程序,我希望有从用户获取目录路径的功能。我想使用一些文件夹浏览器对话框,但我不想从System.Windows.Forms实现它或使用里面的一些巨大的脚本。是否已经实现了WPF中的某些路径获取对话框?

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

我已经阅读了类似问题的答案,但它充满了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.

我没有在工具箱中找到类似的东西,我从WPF开始,所以我可以使用一些帮助。

Thank you in advance :]

先谢谢你 :]

3 个解决方案

#1


11  

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.

请参阅我选择文件夹对话框WPF的答案。基本上,Windows Presentation Foundation 4.5 Cookbook建议您在需要文件夹浏览器时使用适用于Microsoft®.NETFramework的Windows®APICode Pack。

#2


7  

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

我们在项目中使用Ookii Dialogs。它们具有窗户外观和感觉以及过滤等的典型选项。

#3


1  

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.

没有标准的本机WPF对话框,只是因为System.Windows.Forms对话框只不过是系统的包装器。因此,创建WPF包装器毫无意义,只会增加混乱。

#1


11  

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.

请参阅我选择文件夹对话框WPF的答案。基本上,Windows Presentation Foundation 4.5 Cookbook建议您在需要文件夹浏览器时使用适用于Microsoft®.NETFramework的Windows®APICode Pack。

#2


7  

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

我们在项目中使用Ookii Dialogs。它们具有窗户外观和感觉以及过滤等的典型选项。

#3


1  

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.

没有标准的本机WPF对话框,只是因为System.Windows.Forms对话框只不过是系统的包装器。因此,创建WPF包装器毫无意义,只会增加混乱。