Wed, May 16, 2007, 09:11 PM under
dotNET |
Windows |
Vista |
Orcas
Oh, how happy I was when
Orcas started using the Vista CommonFileDialog. Oh, how pissed off I get when applications on Vista still use the old legacy dialog. One of the applications I use a lot is
Reflector and for a while I've been nagging Lutz on IM and email to make Reflector use the new OpenFileDialog, but nothing came of my harassment. Until recently when I noticed that Reflector indeed started showing me the new dialog so I thanked Lutz for finally listening. His reply was that he wasn't aware of it and he had changed nothing other than it now forces it to run against 2.0.50727 using a config file. That put me on a hunt!
The result of the hunt was that with the "Orcas" update of v2.0.50727 (
remember how I explained this a few hours ago) the
System.Windows.Forms.OpenFileDialog has had an internal implementation change that makes it detect if it is on Vista and puts the correct dialog up, rather than the legacy one (on a legacy OS like XP, it will show the old dialog of course). Using reflector, the place to look is
FileDialog.RunDialogVista called by
FileDialog.RunDialog which is called by
CommonDialog.ShowDialog. Great news!
So I then wanted to see if the WPF version has also been updated, in which case half of
VistaBridge would be obsolete (the
TaskDialog half would still be useful of course). Unfortunately, the WPF version of
OpenFileDialog (residing in
Microsoft.Win32 namespace in the
PresentationFramework.dll) has not been updated. I am confident that it will happen by RTM, but in the meantime from your WPF projects you can reference the
System.Windows.Forms.dll and use its Open/SaveFileDialog instead.