WPF 中的OpenFileDialog和 OpenFolderDialog
OpenFolderDialog:
using (var dialog = new System.Windows.Forms.FolderBrowserDialog() { SelectedPath = destinationApp, ShowNewFolderButton = true }) { System.Windows.Forms.DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { //TODO: use dialog.SelectedPath; } }
OpenFileDialog:
using (var dialog = new System.Windows.Forms.OpenFileDialog()) { System.Windows.Forms.DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { //TODO: use dialog.FileName, FileNames; } }