Microsoft.Win32.OpenFileDialog: save file path on cancel
The default Microsoft Office 2010 behavior for persisting the file path of
the Open File dialog seems to return to the last place it had been
navigated.
Open Microsoft Word 2010.
Press Ctrl+O.
The OpenFileDialog opens to, say, C:\Temp\.
Navigate through the file tree to C:\Users\mike\Documents\. Don't select a
file, and cancel the operation.
Press Ctrl+O again.
The dialog will open to the C:\Users\mike\Documents\ directory.
I'd like to duplicate this behavior in my WPF application. However the
Microsoft.Win32.OpenFileDialog class doesn't seem to have a way to do
this. The dialog returns false if Cancel was pressed (as advertised), but
the FileName property doesn't get set if this is the case, and it appears
to be impossible to capture the directory.
Any suggestions for how I can do this?
No comments:
Post a Comment