CastelloBranco.AvaloniaMessageBox
1.0.1
dotnet add package CastelloBranco.AvaloniaMessageBox --version 1.0.1
NuGet\Install-Package CastelloBranco.AvaloniaMessageBox -Version 1.0.1
<PackageReference Include="CastelloBranco.AvaloniaMessageBox" Version="1.0.1" />
<PackageVersion Include="CastelloBranco.AvaloniaMessageBox" Version="1.0.1" />
<PackageReference Include="CastelloBranco.AvaloniaMessageBox" />
paket add CastelloBranco.AvaloniaMessageBox --version 1.0.1
#r "nuget: CastelloBranco.AvaloniaMessageBox, 1.0.1"
#:package CastelloBranco.AvaloniaMessageBox@1.0.1
#addin nuget:?package=CastelloBranco.AvaloniaMessageBox&version=1.0.1
#tool nuget:?package=CastelloBranco.AvaloniaMessageBox&version=1.0.1
AvaloniaMessageBox
A flexible and modern modal message box implementation for Avalonia UI 11.2+.
Supports:
- Classic Desktop applications (
IClassicDesktopStyleApplicationLifetime
) - Single view apps (
ISingleViewApplicationLifetime
) - Early fallback before
MainWindow
orMainView
is ready - DPI-aware sizing and theme-aware font and styling
- Optional icons and multi-line messages
- Modal behavior even in SingleView via panel overlay
✨ Features
- Compatible with .NET 9 and Avalonia 11.2+
- Fully theme-aware (fonts, colors, shadows)
- Automatically localizes button text (
Yes
,No
,OK
,Cancel
) usingCultureInfo.CurrentUICulture
- Supports:
OK
OK / Cancel
Yes / No
- Built-in modern emoji-based icons:
- ℹ️ Info
- ⚠️ Warning
- ❌ Error
- ✅ Success
- ❓ Question
- 🛑✋ Stop (hand over stop sign with overlay)
- Works even before
MainWindow
orMainView
is set
🌍 Localization Support
Button labels (OK
, Cancel
, Yes
, No
) are automatically translated based on the current UI culture (CultureInfo.CurrentUICulture
).
Includes built-in translations for over 68 languages, including:
- pt-BR → "Sim", "Não", "OK", "Cancelar"
- es → "Sí", "No", "OK", "Cancelar"
- fr → "Oui", "Non", "OK", "Annuler"
- de → "Ja", "Nein", "OK", "Abbrechen"
- ja → "はい", "いいえ", "OK", "キャンセル"
- ...and many others
No configuration needed — just set the culture in your app startup code:
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("pt-BR");
🚀 Usage
await AvaloniaWindowedMessageBox.ShowAsync(
parent: this, // Can be a Window or UserControl
title: "Attention",
message: "Are you sure you want to continue?",
buttons: AvaloniaWindowedMessageBox.MessageBoxButtons.YesNo,
icon: AvaloniaWindowedMessageBox.MessageBoxIcon.Question);
You can call it even before setting MainWindow
in your App.cs
:
await AvaloniaWindowedMessageBox.ShowAsync(null, "Startup Error", "The configuration is invalid.");
🧪 Example with Stop Icon
await AvaloniaWindowedMessageBox.ShowAsync(
this,
"Restricted",
"Access denied.",
AvaloniaWindowedMessageBox.MessageBoxButtons.Ok,
AvaloniaWindowedMessageBox.MessageBoxIcon.Stop);
This renders a composite emoji with 🛑 background and ✋ overlaid at center.
🧩 Installation
Simply copy AvaloniaWindowedMessageBox.cs
into your project.
No dependencies or NuGet packages required.
📄 License
MIT License
(c) 2024 Castello Branco Tecnologia
🏷️ Credits
Created and maintained by Castello Branco Tecnologia
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Avalonia (>= 11.2.8)
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 |
---|---|---|
1.0.1 | 211 | 4/23/2025 |