Monday, January 11, 2010

Selct a folder in WPF

Hi
I had a requirement to select the destination folder in WPF. I couldn't find any direct method.After bit of searching i found a method in Schwartz blog.

here the way where u can select the folder using openfiledialog

OpenFileDialog ofd = new OpenFileDialog();
ofd.CheckFileExists = false;
ofd.CheckPathExists = false;
ofd.Multiselect = false;
ofd.FileName = "(Get Folder)";
ofd.Filter = "Folders only|*.FOLDER";
ofd.ShowDialog();
string destinationFolder = ofd.FileName.Substring(0, ofd.FileName.Length - 19);

hope it helps.
Regards
balu

No comments:

Post a Comment