From aba821774905360aa2c1a6c988a39c4184cd1bd9 Mon Sep 17 00:00:00 2001 From: buildcomplete Date: Tue, 9 Apr 2019 16:35:31 +0200 Subject: [PATCH] Fixed InitialFolder so it now works more than first time its called pr. application 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' --- src/Ookii.Dialogs.Wpf/VistaFileDialog.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Ookii.Dialogs.Wpf/VistaFileDialog.cs b/src/Ookii.Dialogs.Wpf/VistaFileDialog.cs index 4524995..cd9315d 100644 --- a/src/Ookii.Dialogs.Wpf/VistaFileDialog.cs +++ b/src/Ookii.Dialogs.Wpf/VistaFileDialog.cs @@ -647,7 +647,11 @@ internal virtual void SetDialogProperties(Ookii.Dialogs.Wpf.Interop.IFileDialog if( !string.IsNullOrEmpty(_initialDirectory) ) { Ookii.Dialogs.Wpf.Interop.IShellItem item = NativeMethods.CreateItemFromParsingName(_initialDirectory); - dialog.SetDefaultFolder(item); + + // 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' + dialog.SetFolder(item); } if( !string.IsNullOrEmpty(_title) )