Wow, That's Pretty and Easy - AutoUpgradeEnabled for Open File Dialog

When you use the OpenFileDialog to allow your users to select files there are actually different styles the window might look like.  When using .NET and running on Vista you can see there is quite a difference.  The picture on the left is a dialog with the new style and the the picture on the right is a dialog that look more like the Windows XP dialog. 

WithStyleWithOutStyle

 

 

 

 

 

 

 

AutoUpgradeEnabled lets you control how it will look.  When it is set to true you will see the new Vista style(when on Vista) and that is the default.  Its also important to note that this property doesn't show up till a later version of .NET, so if you use it on a machine that doesn't at least have .NET 2.0 SP1 you will get a MissingMethodException.

 

BONUS POINTS:

This isn't the first time, and I doubt it will be the last, that a concept like this has been used in Windows.  The BROWSEINFO structure used to open the folder browse dialog contains a flag, BIF_USENEWUI, that shows some historical reference to this pattern.