效果如图
WPF 选择文件夹

使用FolderBrowserDialog

System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
System.Windows.Forms.DialogResult result = dialog.ShowDialog();

if (result == System.Windows.Forms.DialogResult.Cancel)
{
    return;
}
selectFolrderPathTextBlock.Text = dialog.SelectedPath.Trim();

使用FolderBrowserDialog

//引用WindowsAPICodePack
var dialog = new CommonOpenFileDialog();
dialog.IsFolderPicker = true;
CommonFileDialogResult result = dialog.ShowDialog();
if (result == CommonFileDialogResult.Ok)
{
    selectFolrderPathTextBlock.Text = dialog.FileName;
}

示例代码

SelectFolder

参考资料

OpenFileDialog In WPF
C# OPENFILEDIALOG打开文件对话框(详解)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案