FolderBrowserDialog - Win32Exception occurred - The parameter is incorrect

前端 未结 3 2134
再見小時候
再見小時候 2021-02-14 23:09

I try to use the FolderBrowserDialog from WPF like this:

public static bool BrowseFolder(out string folderName)
{
   using (System.Windows.Forms.FolderBrowserDia         


        
相关标签:
3条回答
  • 2021-02-15 00:11

    I do belive you need a windows forms host to run anything from the Windows.Forms namespace... try it out!

    0 讨论(0)
  • 2021-02-15 00:12

    I would try doing it without using the "using" statement, perhaps it is getting cleaned up too quickly.

    0 讨论(0)
  • 2021-02-15 00:15

    This is just a bit of interop nastiness. The WPF code tries to set the focus back to the main window when the dialog is closing. Problem is, the dialog has disabled the window so it can't receive the focus yet. WPF is too eager to change the focus and doesn't otherwise know anything about the dialog behavior. Nothing actually goes wrong.

    0 讨论(0)
提交回复
热议问题