NativeFileDialogNET 2.0.1

dotnet add package NativeFileDialogNET --version 2.0.1                
NuGet\Install-Package NativeFileDialogNET -Version 2.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NativeFileDialogNET" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NativeFileDialogNET --version 2.0.1                
#r "nuget: NativeFileDialogNET, 2.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NativeFileDialogNET as a Cake Addin
#addin nuget:?package=NativeFileDialogNET&version=2.0.1

// Install NativeFileDialogNET as a Cake Tool
#tool nuget:?package=NativeFileDialogNET&version=2.0.1                

NativeFileDialogNET

NativeFileDialogNET is a C# binding for the nativefiledialog-extended library. This project allows you to use native file dialog functionalities in your C# applications.

Usage

Here is a simple example of how to use the library:

using NativeFileDialogNET;

using var selectFileDialog = new NativeFileDialog()
    .SelectFile()
    .AddFilter("Text Files", "*.txt") // Optionally add filters
    .AddFilter("All Files", "*.*");  // Optionally add filters

DialogResult result = selectFileDialog.Open(out string? output, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
Console.WriteLine(result == DialogResult.Okay ? $"Selected file: {output}" : "User canceled the dialog.");

using var selectFolderDialog = new NativeFileDialog()
    .SelectFolder();

result = selectFolderDialog.Open(out string? folder,  Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
Console.WriteLine(result == DialogResult.Okay ? $"Selected folder: {folder}" : "User canceled the dialog.");

using var saveFileDialog = new NativeFileDialog()
    .SaveFile()
    .AddFilter("Text Files", "*.txt")  // Optionally add filters
    .AddFilter("All Files", "*.*");  // Optionally add filters

result = saveFileDialog.Open(out string? saveFile, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "DefaultName.txt");
Console.WriteLine(result == DialogResult.Okay ? $"Selected file: {saveFile}" : "User canceled the dialog.");

Contributions are welcome! Please feel free to submit a pull request.

License

This project is licensed under the zlib License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 34 12/1/2024
2.0.0 117 7/29/2024
1.0.2 134 4/24/2024
1.0.1 107 4/22/2024
1.0.0 96 4/22/2024

Fix: SelectFolder always returns DialogResult.Error - pull-request #3