14

I'm looking to customize the Vista-like OpenFileDialog with custom WinForms and WPF controls. I know you can template the XP-like OpenFileDialog but that looks pretty ugly and doesn't satisfy my requirements. I know you can customize the OpenFileDialog with either the Ookii dialogs or from Microsoft's API Code Pack. The problem with this approach is that they don't allow for custom controls, only a limited subset of controls (Label, TextBox, etc.).

The closest I've gotten is the below image. Using a combination of the API Code Pack, some changes to the Shell, a hack-job of adding empty labels for the spacing, with a bunch of ugly COM to draw the control directly on the OpenFileDialog I was able to get close.

The problem with this approach is that I have to disable re-sizing in the WndProc because the controls section in the CommonOpenFileDialog has a flow/wrap layout and you can't dynamically add/remove controls on re-size or you get a catastrophic failure if the OpenFileDialog has already been shown.

Are there any suggestions beyond what I have tried or any third-party products that work as the standard Vista-like OpenFileDialog but allow for insertion of custom controls?

[

I also tried rolling my own using the ExplorerBrowser from the API Code Pack (as in the image below) but despite combing over the COM API there doesn't seem like a way to define filters in the ExplorerBrowser.

[

C. Augusto Proiete
  • 24,684
  • 2
  • 63
  • 91
Brian Mullen
  • 151
  • 7
  • IFileDialogCustomize supports plenty of doodahs. But it is not infinitely extensible and you don't have the flexibility you are probably looking for. Nor is it possible to bolt on something completely new. Nothing you can do but settle for what is supported. – Hans Passant Feb 13 '13 at 16:30
  • **Why** are you trying to "customize the FileOpen dialog"? What are your "custom controls" going to be doing? – Dour High Arch Feb 13 '13 at 17:28
  • @DourHighArch - I want to add a thumbnail filmstrip as shown in the first image but for a custom file type. There needs to be additional data that will be contained within a tool tip. There are also some configuration parameters that users can optionally define that affect how the thumbnails are rendered. It's not merely a matter of setting up IPreviewHandler for the file type. – Brian Mullen Feb 13 '13 at 19:54
  • 12
    Why not design the dialog from scratch? – Mathieu Guindon Mar 13 '13 at 22:14
  • This guy created a treeview directory. https://www.youtube.com/watch?v=6OwyNiLPDNw&list=PLrW43fNmjaQVYF4zgsD0oL9Iv6u23PI6M&index=2 It can give you some hints to create your own OpenFileDialog. – Mr. Leeds Jun 28 '18 at 03:38
  • Take a look at this CodeProject article [link](https://www.codeproject.com/Articles/42008/Extend-OpenFileDialog-and-SaveFileDialog-Using-WPF) – Congenital Optimist Dec 04 '18 at 09:04
  • If you're willing to pay a bit, Telerik may have the WPF controls you want in their RadControl for WPF. See https://www.telerik.com/products/wpf/file-dialogs.aspx – jschroedl Nov 11 '19 at 01:25

2 Answers2

0

This sort of thing can easily be written from scratch using WPF and XAML. If necessary, there are controls for easy sub component you want.

If you try to modify an existing file dialog, you'll be limited and may hit a brick wall later on.

Paul Sumpner
  • 447
  • 7
  • 8
-1

Fully agree with Paul Sumpner. If Ookii dialogs is not suitable than, the only other option in my opinion is to build your own from scratch.