I have this helper method to allow a user to select a folder where we will save images to:
internal static string SelectFolder(Window window, string initialDirectory)
{
var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog
{
SelectedPath = initialDirectory,
RootFolder = System.Environment.SpecialFolder.UserProfile
};
return (dialog.ShowDialog(window).GetValueOrDefault())
? dialog.SelectedPath
: string.Empty;
}
It works just fine in that it opens the dialog and returns the selected folder path.
However, when the user opens the dialog again to change the folder, for some reason the dialog always opens up in the folder above the initialDirectory
So for example, say I select C:\users\Bassie\Pictures
as my folder. If I want to change the folder later, the dialog will open up at C:\users\Bassie
, even though initialDirectory
is defintely sent through with the entire path.
How can I resolve this?
I do not have the documentation, but I believe that this can be solved by including the trailing "\" for the directory path.
For instance, C:\users\Bassie\Pictures\