Lester's WPF\SL Blog

Simple, Easy & Beautiful

Vista style Open/Save FileDialogs

Vista style Open/Save FileDialogs

  • Comments 6

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
  • Could not find the sample or the VistaBridgeLibrary mentioned in this article.

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

  • Thomson, you can get the sample and library from here

    http://msdn2.microsoft.com/en-us/library/ms756482.aspx

    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

  • 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.

  • 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...

    Karl

  • 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.

Page 1 of 1 (6 items)