5

I'm using Microsoft.Win32.OpenFileDialog in my wpf application since it is stated as equivalent here; http://msdn.microsoft.com/en-us/library/ms750559.aspx

I set the RestoreDirectory property to true, but it has no effect. When I wait on the property it is documented that "This property is not implemented."

So how can I achieve this task without implementing the logic myself?

AFgone
  • 1,172
  • 4
  • 16
  • 31

1 Answers1

3

RestoreDirectory is automaticly implemented.

string fileName = string.Empty;

var dialog = new OpenFileDialog();
dialog.InitialDirectory = @"c:\test";
if (dialog.ShowDialog() == true)
    fileName = dialog.FileName;

if you don't specify InitialDirectory it will open last selected file's directory

Enhakiel
  • 316
  • 2
  • 10
  • 3
    No, it's not implemented in WPF version. RestoreDirectory is supposed to restore the last folder, after the dialog is closed. It doesn't. – Eternal21 Jul 28 '15 at 18:34