James Cronen
James Cronen

Reputation: 5763

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.

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

Answers (1)

James Cronen
James Cronen

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

Related Questions