Custom Places in FileDialog box
If you ever tried to Open a File from Visual Studio, you may notice something like Projects Folder in the Open File Dialog.
We can also implement the same functionality in our applications by using CustomPlaces collection property of FileDialog class. The OpenFileDialog and SaveFileDialog classes allow you to add folders to the CustomPlaces collection.
openFileDialog.CustomPlaces.Add(@"C:\Users");
You can also specify GUID of Windows Vista known folder. Known Folder GUIDs are not case sensitive and are defined in the KnownFolders.h file in the Windows SDK. If the specified Known Folder is not present on the computer that is running the application, the Known Folder is not shown.
openFileDialog.CustomPlaces.Add(@"C:\Users");
//Desktop Folder
openFileDialog.CustomPlaces.Add(new Guid("B4BFCC3A-DB2C-424C-B029-7FE99A87C641"));
//Downloads Folder
openFileDialog.CustomPlaces.Add(new Guid("374DE290-123F-4565-9164-39C4925E467B"));
Note: This feature will not have any effect in Windows XP. Also you must set the AutoUpgradeEnabled to True(default) to enable this feature in Vista or Windows 7.
The following table lists few Windows Vista Known Folders and their associated Guid.
- Contacts : 56784854-C6CB-462B-8169-88E350ACB882
- ControlPanel : 82A74AEB-AEB4-465C-A014-D097EE346D63
- Desktop : B4BFCC3A-DB2C-424C-B029-7FE99A87C641
- Documents : FDD39AD0-238F-46AF-ADB4-6C85480369C7
- Downloads : 374DE290-123F-4565-9164-39C4925E467B
- Favorites : 1777F761-68AD-4D8A-87BD-30B759FA33DD
- Fonts : FD228CB7-AE11-4AE3-864C-16F3910AB8FE
- Music : 4BD8D571-6D19-48D3-BE97-422220080E43


