![]() |
VOOZH | about |
dotnet add package YngveHestem.FileDialog.GumMonoGame --version 1.0.0
NuGet\Install-Package YngveHestem.FileDialog.GumMonoGame -Version 1.0.0
<PackageReference Include="YngveHestem.FileDialog.GumMonoGame" Version="1.0.0" />
<PackageVersion Include="YngveHestem.FileDialog.GumMonoGame" Version="1.0.0" />Directory.Packages.props
<PackageReference Include="YngveHestem.FileDialog.GumMonoGame" />Project file
paket add YngveHestem.FileDialog.GumMonoGame --version 1.0.0
#r "nuget: YngveHestem.FileDialog.GumMonoGame, 1.0.0"
#:package YngveHestem.FileDialog.GumMonoGame@1.0.0
#addin nuget:?package=YngveHestem.FileDialog.GumMonoGame&version=1.0.0Install as a Cake Addin
#tool nuget:?package=YngveHestem.FileDialog.GumMonoGame&version=1.0.0Install as a Cake Tool
A MonoGame and Gum-based file dialog implementation that provides cross-platform file and folder selection dialogs for MonoGame applications.
StorageProviders: Observable collection of available storage locationsOpenDialog(): Display the dialog to the userCloseDialog(): Programmatically close the dialogFilterStorageItems(): Virtual method to override and filter displayed files/foldersUpdate(): Static method that must be called from Game.Update() to process UI updates on the game threadOpenFileDialog: Browse and select a single file
AllowedFileTypes: Property to restrict selectable file extensions (e.g., [".txt", ".pdf"])FileSelected: Event triggered when a file is selectedOpenFolderDialog: Browse and select a single folder
FolderSelected: Event triggered when a folder is selectedSaveFileDialog: Browse and save a file with a chosen name
FileSaved: Event triggered when a file is savedOpenFileDialogOptions, OpenFolderDialogOptions, SaveFileDialogOptions): Configure dialog behavior and appearanceInitialize a dialog:
var openFileDialog = new OpenFileDialog("Select a file");
openFileDialog.AllowedFileTypes = new List<string> { ".txt", ".png", ".jpg" };
openFileDialog.FileSelected += (dialog, file) =>
{
Console.WriteLine($"Selected: {file.Name}");
};
Add storage providers: In this example, YngveHestem.Storage.Local is used as storage provider. See below for more info.
var localProvider = new LocalStorageProvider();
var folder = await localProvider.TryGetFolderAsync(Environment.GetFolderPath(
Environment.SpecialFolder.MyDocuments));
if (folder != null)
{
openFileDialog.StorageProviders.Add(folder);
}
Display the dialog:
openFileDialog.OpenDialog();
The dialog uses a main-thread dispatcher to ensure all UI updates happen on the game thread. You must call FileDialog.Update() from your MonoGame Game class's Update() method (including neccessarry set up of Gum.MonoGame):
public class MyGame : Game
{
protected override void Update(GameTime gameTime)
{
GumService.Default.Update(this, gameTime);
// Process pending file dialog UI updates
GumMonoGame.FileDialog.Update();
base.Update(gameTime);
}
}
Without this call, file dialogs will not function correctly and UI updates may not be processed.
See the samples in the repository for a complete example.
The file dialogs work out of the box with a default appearance and behavior—you only need to provide at least one storage location via StorageProviders. The dialogs are fully functional for basic file and folder selection tasks.
However, to make the dialogs fit seamlessly into your game's visual style, you can customize them extensively using the FileDialogOptions classes:
FileDialogOptions: Base configuration for all dialogs
VisualFactory: Customize the appearance and layout of UI elementsDoubleClickSeconds: Adjust double-click detection timingShowAddNewFolderButton: Show/hide folder creation buttonHideStorageProviderListIfNotMoreThan1: Auto-hide provider list when there's only oneOpenFileDialogOptions: File-specific customization (extends FileDialogOptions)
OpenFolderDialogOptions: Folder-specific customization (extends FileDialogOptions)
SaveFileDialogOptions: Save-specific customization (extends FileDialogOptions)
By leveraging the VisualFactory in these options, you can create custom Gum layouts and themes that match your game's aesthetic perfectly.
This library works seamlessly with the Storage abstraction layer. You can use different storage providers (local, WebDAV, cloud, etc.) as sources for your file dialogs (or create your own):
using YngveHestem.Storage.Local;
var provider = new LocalStorageProvider();
var documentsFolder = await provider.TryGetFolderAsync("/path/to/documents");
var dialog = new OpenFileDialog("Open Document");
dialog.StorageProviders.Add(documentsFolder);
dialog.OpenDialog();
If you have created or know of a supported implementation of the Abstractions and want it listed. Create an issue or pull-request.
See LICENSE file in the repository root.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 166 | 12/6/2025 |
- Initial release