Reputation: 5763
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.
C:\Temp\
.C:\Users\mike\Documents\
. Don't select a file, and cancel the operation.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?
Upvotes: 1
Views: 781
Reputation: 5763
Thanks to everyone who responded. The answer appears to be that there is no answer.
Thanks to Jim Mischel for this link in the comments, which may provide a start: stackoverflow.com/q/4106120/56778
Also to Hans Passant for his comment 'You'll have to get to the IFileDialogEvents. It isn't entirely impossible but you'll get no help from WPF.'
I have a deadline for which this feature isn't critical, so I'm abandoning this for now. If I ever come up with a solution I'll post it here.
Upvotes: 1