FolderBrowserDialog - Win32Exception occurred - The parameter is incorrect

前端 未结 3 1962
天涯浪人
天涯浪人 2021-02-14 23:37

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-14 23:51

    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.

提交回复
热议问题