Just add reference to the WPF.Dialogs library to your WPF project.

925521

Create an alias for WPF.DIalogs namespace:

    using WPF.Dialogs;


And use OpenFolderDialog in the same way as you usually use other WPF dialogs (OpenFileDialog for example)

Sample:
        private void btnSelectFolderOnClickHandler(Object sender, RoutedEventArgs e)
        {
            var dlgInitialDirectory = new OpenFolderDialog();
            dlgInitialDirectory.Description = "Select folder";
            dlgInitialDirectory.RootFolder = Environment.SpecialFolder.MyComputer;
            dlgInitialDirectory.SelectedPath = (String) lblPath.Content;
            dlgInitialDirectory.ShowNewFolderButton = false;
            if (dlgInitialDirectory.ShowDialog() == true)
            {
                lblPath.Content = dlgInitialDirectory.SelectedPath;
            }
        }


925520

Last edited Oct 30, 2014 at 7:44 AM by AlexPadabed, version 1