XTOOLKIT
XTOOLKIT
Collection of utilities, helper classes and WPF controls

File System Browser utilities in xToolkit


Browse Folder

Function browses for a folder allowing to optionally specify the caption of the browse dialog

if (FileSystemBrowser.BrowseFolder(out string path, "Select sample folder"))
{
    Console.WriteLine($"Selected path: {path}");
}
else 
{
    Console.WriteLine("User has cancelled the folder browsing");
}

Browse for folder
Browse for folder

Browse File

Filters

Use the function below to build the filters mask or use the predefined filters available

File Filters
File Filters

var filters = FileSystemBrowser.BuildFilterString(
    new FileFilter("Text Files", "*.txt", "*.doc", "*.md"), 
    FileFilter.ImageFiles, 
    FileFilter.AllFiles);

Open

Shows the file open dialog

if (FileSystemBrowser.BrowseFileOpen(out string fileIn, "Select input file", filters)) 
{
    Console.WriteLine($"Selected path: {fileIn}");
}
else
{
    Console.WriteLine("User has cancelled the file browsing");
}

Save

Shows the file save dialog

if (FileSystemBrowser.BrowseFileSave(out string fileOut, "Select output file", filters))
{
    Console.WriteLine($"Selected path: {fileOut}");
}
else
{
    Console.WriteLine("User has cancelled the file browsing");
}


Powered by Docify