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!!
Comments
Anonymous
May 17, 2007
Could not find the sample or the VistaBridgeLibrary mentioned in this article.Anonymous
May 17, 2007
The only problem I see is I will need to build a new version of my project if the VistaBridge library is updated.Anonymous
May 18, 2007
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 libraryAnonymous
June 16, 2007
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.Anonymous
June 30, 2007
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... KarlAnonymous
July 11, 2007
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.