How to use a FolderBrowserDialog from a WPF application

前端 未结 10 2095
青春惊慌失措
青春惊慌失措 2020-12-02 10:29

I\'m trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I don\'t much care that it has the Windows Forms look to it.

However, when I call

10条回答
  •  心在旅途
    2020-12-02 10:59

    Here is a simple method.

    
    System.Windows.Forms.NativeWindow winForm; 
    public MainWindow()
    {
        winForm = new System.Windows.Forms.NativeWindow();
        winForm.AssignHandle(new WindowInteropHelper(this).Handle);
        ...
    }
    public showDialog()
    {
       dlgFolderBrowser.ShowDialog(winForm);
    }
    
    

提交回复
热议问题