ookii-dialogs / ookii-dialogs-wpf

Awesome dialogs for Windows Desktop applications built with Microsoft .NET (WPF)
BSD 3-Clause "New" or "Revised" License
1.14k stars 85 forks source link

Fixed InitialFolder so it now works more than first time its called p… #2

Open buildcomplete opened 5 years ago

buildcomplete commented 5 years ago

The dialog.SetDefaultFolder(item) is only set first time the applications sets the folder, Next time the folder will be restored to last picked object and the 'Default folder' is ignored Use instead dialog.SetFolder which behaviour better matches the name 'InitialFolder'

buildcomplete commented 5 years ago

Regarding the behaviour:

In our Application the user specifies many different filetypes, so dependant on the category we restore the default directory or last used for the category in either filepickers or folderpicker... therefore we need this functionality.

we have code like this many places in our application

var path = WpfShellDialogs.UserOpenFile(
    "*.xml",
    "Prediction model (.xml)|*.xml",
    FolderProvider.GetLastOrDefaultFolder(FolderProvider.FolderName.PredictionModel));

Maybe a better fix would be something like

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.