Configuring OpenFileDialog in .Net

You must create your own custom .Net OpenFileDialog on Windows XP and Windows Vista / 7. Add new controls to it, etc. Is there a way to configure a standard OpenFileDialog in .Net (specifically for WPF)? I looked at solutions like OpenFileDialogEx , but everything related to a WINAPI connection is unacceptable to me. Maybe you know a way to extract native dialogs through Reflection or something else? How is native OpenFileDialog implemented in Windows Vista / 7? Is it written in WPF? Thanks in advance.

Sincerely, Pavel.

+7
windows-7 windows-xp wpf openfiledialog
source share
3 answers

Get used to it, because this is what you need. OpenFileDialog is not written in WPF, the dialog exists as unmanaged code inside Windows. The managed shell uses GetOpenFileName () for legacy versions; the IFileOpenDialog COM interface for current ones. For the latter, the IFileDialogCustomize interface was designed to customize the dialog.

These interfaces are easy to use from a C ++ program, the classic scourge of shell programming. The need to support XP computers is also a significant headache, and you really get hung up on the outdated dialog via GetOpenFileName (). This is what this code project does.

+4
source share

There is a wrapper for OpenFileDialog in Windows API Code Code . This causes you a lot of difficulties related to P / Invoking. You can use it from WPF, from Windows Forms, whatever.

+3
source share

You can take a look at the CodeProject link.

This is an interesting way to create almost any dialog with a file that you may need. And the author includes a link to the version of WPF, as well as an original article written with XP in mind.

+2
source share

All Articles