We are using the CustomPlaces
property of the Open/SaveFileDialog to show the users a variety of configured standard folders that they could use.
What we would like now is to have the InitialDirectory
property point to the created CustomPlaces
"folder". Has anyone been able to do this?
I have read through the MSDN articles for the FileDialog class (and the subsequence OpenFileDialog and SaveFileDialog), the InitialDirectory property, the Environment.SpecialFolder enumerator and KNOWNFOLDERID list, but all to no avail.
I have also tried to set the InitialDirectory
property to the application's name incase that was the magic.
Code used for the OpenFileDialog (the directories are demos atm):
using (OpenFileDialog tempDiag = new OpenFileDialog())
{
tempDiag.CustomPlaces.Add(@"C:\Temp\");
tempDiag.CustomPlaces.Add(@"C:\Program Files\");
tempDiag.ShowDialog();
}
Desired default selection when calling the tempDiag.ShowDialog();
:
I am aware that one could entirely customize the XOpenDialog via the methods described in this CodeProject article, but I feel that that would be a bit extreme just for the default selection at this point.