Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure dialog for multiple folder (or files) picker?

Tags:

c#

I am using this lib https://github.com/augustoproiete/ookii-dialogs-wpf for dialog presentation.

I am using such dialog for pick singe folder

        private void Btn_path_to_save_processed_clip_folder_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog
            {
                Description = "Select where to save processed clip folder",
                SelectedPath = m_TbClipSaveDirectory,
                UseDescriptionForTitle = true
            };

            if (dialog.ShowDialog(Application.Current.MainWindow).GetValueOrDefault())
            {
                m_TbClipSaveDirectory = dialog.SelectedPath;
            }
        }

Question is - is there an option to pick a few folders at once?

Or maybe some others ways?

like image 605
Aleksey Timoshchenko Avatar asked Nov 16 '25 15:11

Aleksey Timoshchenko


1 Answers

Eventually I made it with NuGet

1) Right click on project -> Manage NuGet packages -> in browse tab fill WindowsAPICodePack-Shell and set up into needed package

2) Create dialog

using var dialog = new CommonOpenFileDialog
{
    IsFolderPicker = true,
    Multiselect = true
};

Here you can see two settings IsFolderPicker - in order to chose only folders not a files and Multiselect - for multiselection

and eventually result

if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
    var folders = dialog.FileNames;
    MessageBox.Show(string.Join("\n", folders));
}

Result is:

Result

like image 156
Aleksey Timoshchenko Avatar answered Nov 18 '25 06:11

Aleksey Timoshchenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!