とりあえず、Windows API を使用してフォルダ選択ダイアログを表示することはできますね。
C#
1using System.Runtime.InteropServices;
2// 中略 //
3
4namespace WpfApp
5{
6 public partial class MainWindow : Window
7 {
8 private const int MAX_PATH = 260;
9 private const int BIF_RETURNONLYFSDIRS = 0x01;
10 private const int BIF_EDITBOX = 0x10;
11 private const int BIF_VALIDATE = 0x20;
12 private const int BIF_NEWDIALOGSTYLE = 0x40;
13
14 private delegate int BrowseCallbackProc(IntPtr hwnd, int uMsg, IntPtr lParam, IntPtr lpData);
15
16 [StructLayout(LayoutKind.Sequential)]
17 private struct BROWSEINFO
18 {
19 public IntPtr hwndOwner;
20 public IntPtr pidlRoot;
21 public IntPtr pszDisplayName;
22 [MarshalAs(UnmanagedType.LPTStr)]
23 public string lpszTitle;
24 public uint ulFlags;
25 public BrowseCallbackProc lpfn;
26 public IntPtr lParam;
27 public int iImage;
28 }
29
30 [DllImport("shell32.dll")]
31 private static extern IntPtr SHBrowseForFolder(ref BROWSEINFO lpbi);
32
33 [DllImport("shell32.dll")]
34 [return: MarshalAs(UnmanagedType.Bool)]
35 private static extern bool SHGetPathFromIDListW(IntPtr pidl, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder pszPath);
36
37 [DllImport("ole32.dll")]
38 private static extern void CoTaskMemFree(IntPtr pv);
39
40 public MainWindow()
41 {
42 InitializeComponent();
43 }
44
45 private void button_Click(object sender, RoutedEventArgs e)
46 {
47 var bi = new BROWSEINFO();
48 var helper = new System.Windows.Interop.WindowInteropHelper(this);
49 bi.hwndOwner = helper.Handle;
50 bi.pidlRoot = IntPtr.Zero;
51 bi.pszDisplayName = IntPtr.Zero;
52 bi.lpszTitle = "フォルダ選択";
53 //bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_EDITBOX | BIF_VALIDATE | BIF_NEWDIALOGSTYLE;
54 bi.ulFlags = BIF_EDITBOX | BIF_VALIDATE | BIF_NEWDIALOGSTYLE;
55 bi.lpfn = null;
56 bi.lParam = IntPtr.Zero;
57 IntPtr pid = SHBrowseForFolder(ref bi);
58 if(pid != IntPtr.Zero)
59 {
60 var buff = new StringBuilder(MAX_PATH);
61 if(SHGetPathFromIDListW(pid, buff))
62 {
63 MessageBox.Show(buff.ToString(), "テスト", MessageBoxButton.OK, MessageBoxImage.Information);
64 }
65 CoTaskMemFree(pid);
66 }
67 }
68 }
69}