Vista style Open/Save FileDialogs

If you have tried creating FileDialogs in WPF, they usually do not blend well into the Vista look.

The solution is to use the wrappers provided in the VistaBridge library which is part of the SDK samples. You could include the library dll (around 100k) in your project and then make the simple call to CommonOpenFileDialog/CommonSaveFileDialog ... The other option being to just include the specific classes in the project.

CommonSaveFileDialog saveDialog = new CommonSaveFileDialog();

Its that easy!!

Share this post

Comments (6)

  1. Thomson says:

    Could not find the sample or the VistaBridgeLibrary mentioned in this article.

  2. DamageInc says:

    The only problem I see is I will need to build a new version of my project if the VistaBridge library is updated.

  3. Thomson, you can get the sample and library from here

    DamageInc, your concerns are valid but the calls are standard and are unlikely to change. The other option to using the dll is to use the specific code classes provided in the library

  4. Dirk says:

    Did anyone at Microsoft tried this under Vista x64? Apparently not. When clicking on the buttons in the VistaInteropDemoApp it either crashes or nothing happens. Setting the platform target of the VistaInteropDemoApp to x86 solves the problem.

    I really doubt that making "Any CPU" the default target in C# projects was a good decision. I bet a lot of developers do not expect these problems when their application is run under x64.

    As soon as you have some interop stuff (COM interop, P/Invoke or C++/CLI with /clr or /clr:pure) in your project/solution there are likely to be problems.

  5. Dirk,

    Thank you for your comments on Vista x64.  I spent two hours before I found this site.

    Total bummer this was not easy wrapped for WPF…


  6. Keeron says:

    If you use Orcas (Beta 1 onwards), you can get these dialogs for free. The underlying OpenFileDialog class will determine the OS version and show the correct dialog.

Skip to main content