我正在寻找并打开文件夹对话框(wpf)。我得到了 wpf 的 Ookii 对话框,我使用了 VistaFolderBrowserDialog。(我不喜欢 Windows 窗体的 FolderBrowserDialog)。
我保存“最后打开的文件夹”。因此,下次用户打开此 VistaFolderBrowserDialog 时,初始文件夹是我保存的“最后一个”。
...
//Save the new actual folder
MyProject.ProgramConfigurationFile.Instance.OpenFolderPath = System.IO.Path.GetDirectoryName(folderDialog.SelectedPath);
VistaFolderBrowserDialog 具有属性 => RootFolder:
公共环境..::..SpecialFolder RootFolder { get; 放; 但它是一个 SpecialFolder 类型。
所以我正在寻找一种将我的 String OpenFolderPath 设置为 RootFolder 属性的方法。
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
folderDialog.Description = "Please select the folder";
folderDialog.UseDescriptionForTitle = true;
if ((bool)folderDialog.ShowDialog(this))
{
//Get the last open folder saved (if exist).
if(!String.IsNullOrEmpty(MyProject.ProgramConfigurationFile.Instance.OpenFolderPath))
{
folderDialog.RootFolder = Environment.SpecialFolder. //I would like to set OpenFolderPath
}
}
也欢迎使用其他文件夹浏览器。
非常感谢。