Customizing OpenFileDialog in .Net Customizing OpenFileDialog in .Net wpf wpf

Customizing OpenFileDialog in .Net


Get used to it because that what it takes. OpenFileDialog is not written in WPF, the dialog exists as unmanaged code inside Windows. The managed wrapper uses GetOpenFileName() on legacy versions, the IFileOpenDialog COM interface on current ones. For the latter one, the IFileDialogCustomize interface was designed to customize the dialog.

These interfaces are only easy to use from a C++ program, a classic scourge of shell programming. Having to support XP machines is a considerable headache as well, realistically you are stuck with the legacy dialog through GetOpenFileName(). Which is what that code project does.


There is a wrapper for the OpenFileDialog in the Windows API Code Pack. It gets you around a lot of the difficulty of P/Invoking it yourself. You can use it from WPF, from Windows Forms, whatever.


You might take a look at this CodeProject link.

It's an interesting way to create just about any file dialog you might want. And the author includes a link to a WPF version as well as the original article written with XP in mind.