VistaFolderBrowserDialog: Set InitialDirectory (not SelectedPath) #35
Labels
enhancement
New feature or request
hacktoberfest
https://hacktoberfest.digitalocean.com
help wanted
Extra attention is needed
up-for-grabs
Milestone
The
VistaFolderBrowserDialog
does not have anInitialDirectory
property (like the open/save file variants do). TheSelectedPath
property sounds similar, but actually navigates to the parent directory and sets the given directory name as input for the textbox at the bottom.Unless (hidden feature) you append a trailing backslash or slash. In that case, the dialog opens in the given path and nothing is selected.
I guess this only works because
Path.GetDirectoryName(..)
is tricked into a different result here: https://github.com/augustoproiete/ookii-dialogs-wpf/blob/d157189c795d4fdb500662bde8ad328d7d3eb602/src/Ookii.Dialogs.Wpf/VistaFolderBrowserDialog.cs#L280-L290Whatever the implementation details, it would be good to have an explicit API that allows to set the initial directory.
Additional remarks:
Path.DirectorySeparatorChar
(backslash) worksPath.AltDirectorySeparatorChar
(slash) works, too but I'm on windows 10. Not sure if that makes any difference.My code looks like this for now:
The text was updated successfully, but these errors were encountered: