BetterFolderBrowser 1.0.0
See the version list below for details.
dotnet add package BetterFolderBrowser --version 1.0.0
NuGet\Install-Package BetterFolderBrowser -Version 1.0.0
<PackageReference Include="BetterFolderBrowser" Version="1.0.0" />
paket add BetterFolderBrowser --version 1.0.0
#r "nuget: BetterFolderBrowser, 1.0.0"
// Install BetterFolderBrowser as a Cake Addin #addin nuget:?package=BetterFolderBrowser&version=1.0.0 // Install BetterFolderBrowser as a Cake Tool #tool nuget:?package=BetterFolderBrowser&version=1.0.0
BetterFolderBrowser
BetterFolderBrowser is a .NET component library that was written to help developers provide a better folder-browsing and selection experience to users by employing a similar browser dialog as the standard OpenFileDialog in place of the current FolderBrowserDialog which only allows for single-folder selections with its tree-view display format. This allows for a much easier viewing, modification, searching and selection experience using the standard Windows Explorer dialog.
Features
- Works with .NET 2.0 and above allowing for usability across most .NET applications.
- Built as a component making it accessible in Design Mode.
- Uses the same dialog model as the OpenFileDialog, making it super easy for users to view, search, select, and modify folders when opened.
- Allows passing of literal paths as strings to the
RootFolder
property. - Allows multiple selection of folders in constrast to the standard WinForms FolderBrowserDialog which only allows for single-folder selections. One can then access the list of selected folders using the property
SelectedPaths
or its variantSelectedFolders
property. - The dialog can be displayed either blocking the UI thread or not using the
ShowDialog(IWin32Window)
orShowDialog()
methods respectively. - Provides additional custom UITypeEditor variants for folder-selection within the Properties window. They include the
SelectedPathEditor
(for single folder selection) andSelectedPathsEditor
(for multiple folder selection) for use in-place of the standard WinForms SelectedPathEditor. For usage of these editors, ensure you import the namespaceWK.Libraries.BetterFolderBrowserNS.Editors
. Here are two examples of properties implementing the given custom editors:
// Allows selection of one folder. [Editor(typeof(SelectedPathEditor), typeof(UITypeEditor))] public string MyFolderPath { get; set; } // Allows selection of many folders. [Editor(typeof(SelectedPathsEditor), typeof(UITypeEditor))] public string[] MyFolderPaths { get; set; }
Usage
If you prefer working with the Designer, simply add the component to Visual Studio's Toolbox and use the Properties window to change its options:
To use it in code, first import WK.Libraries.BetterFolderBrowserNS
- the code below will then assist you:
var betterFolderBrowser = new BetterFolderBrowser();
betterFolderBrowser.Title = "Select folders...";
betterFolderBrowser.RootFolder = "C:\\";
// Allow multi-selection of folders.
betterFolderBrowser.Multiselect = true;
if (betterFolderBrowser.ShowDialog() == DialogResult.OK)
{
string[] selectedFolders = betterFolderBrowser1.SelectedFolders;
// If you've disabled multi-selection, use 'SelectedFolder'.
// string selectedFolder = betterFolderBrowser1.SelectedFolder;
}
If you'd prefer blocking the main UI thread when calling the dialog, simply specify the window owner of the dialog using the ShowDialog(IWin32Window)
method:
if (betterFolderBrowser.ShowDialog(this) == DialogResult.OK)
{
// ...
}
Note that we've specified the owner with the keyword this
since we're calling the dialog from the Form where it is hosted.
If you're calling the dialog from within a custom UserControl and would prefer blocking the main UI thread when calling it, you can still specify the window owner using the ShowDialog(IWin32Window)
method:
if (betterFolderBrowser.ShowDialog(this.FindForm()) == DialogResult.OK)
{
// ...
}
Donate
Hey, you can always buy me a coffee if this component (and others) have been of value to you. 😃
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
This package has no dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on BetterFolderBrowser:
Package | Downloads |
---|---|
CodeArtEng.Controls
WinForms User Controls |
|
SuperUsefulExtensionLibrary
A library of super useful extension methods to make your life easier. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on BetterFolderBrowser:
Repository | Stars |
---|---|
TexTools/FFXIV_TexTools_UI
|
Initial Release.