How can one create a user control that has the same functionality (along with some extended features) of OpenFileDialog in C#? I\'ve followed this, but I could not find a s
You most likely need to use the raw Windows interface to achieve this. At a high level you do this:
IFileOpenDialog
interface to register your interface to handle events. That interface is IFileDialogControlEvents
and is implemented by you. You have to implement both that interface and IFileDialogEvents
.This is only available in Vista. If you need to support XP then you need to use GetOpenFileName
and supply a resource template for your customisation. That's really no fun at all, especially from managed code! A C++/CLI library makes this a bit more manageable.
OpenFileDialog
is a Windows built-in feature (it's non-.NET at all), so extending it is quite a nontrivial task. Why don't you just build it from scratch or look for any existing solutions?
The OpenFileDialog is a sealed
class, and as such can't be inherited or extended. Your best bet would be to write your own open file dialog.
On the other hand, the FileDialog class isn't sealed, so you could inherit from that and make the necessary customizations. See http://www.codeproject.com/KB/dialog/OpenFileDialogEx.aspx for more information