How to use a FolderBrowserDialog from a WPF application with MVVM
- by David Work
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.
I found a question with a suitable answer (How to use a FolderBrowserDialog from a WPF application), except I'm using MVVM.
This was the answer I "implemented", except I can't get the window object and I'm just calling ShowDialog() without any parameters.
The problem is this:
var dlg = new FolderBrowserDialog();
System.Windows.Forms.DialogResult result = dlg.ShowDialog(this.GetIWin32Window());
In my ViewModel there the this has no GetIWin32Window() method for me to get the Window context.
Any ideas on how to make this work?