MessageBoxSlim.Avalonia 0.9.8

dotnet add package MessageBoxSlim.Avalonia --version 0.9.8
NuGet\Install-Package MessageBoxSlim.Avalonia -Version 0.9.8
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="MessageBoxSlim.Avalonia" Version="0.9.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MessageBoxSlim.Avalonia --version 0.9.8
#r "nuget: MessageBoxSlim.Avalonia, 0.9.8"
#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 MessageBoxSlim.Avalonia as a Cake Addin
#addin nuget:?package=MessageBoxSlim.Avalonia&version=0.9.8

// Install MessageBoxSlim.Avalonia as a Cake Tool
#tool nuget:?package=MessageBoxSlim.Avalonia&version=0.9.8

MessageBoxSlim.Avalonia

A smaller more focused Version of MessageBox.Avalonia

NEW in 0.9.8: User Message Box styling with a new example showcasing this new feature. Also moved another Utility class into the Root Namespace for easier access.

My goal was to build a cross-platform message box that doesn't try to be super fancy and also to remove a lot of unneeded complexity. This fork tries to create a more platform to platform default experience instand of extra features.

The major differences are:

  • Only one MessageBox Type. The removal of the custom message box is opionated but if you want custom buttons back that should be easy to add to the new class if you need it.
  • No prebaked Icons included. You can still use those from the Example but now the API expects that you have your own Icons
  • Code simplification, identifier are shorter and no longer clash with bultins
    • Examples
      • Show and ShowDialog are renamed to ShowAsync and ShowDialogAsync
      • Style is now Called BoxStyle
  • A can only be constructed with the DTO Object
    • I did this to keep things simple for now
  • The Button Parameter is now a bitfield. You can now combine every button combination you want. See the Example Project for Code Snippets.
  • Improved and simplified XAML Layout
  • Removed Header Property (Use Title instead)
  • Removed the colorful Buttons
  • A MessageBox will now by default be shown in the center of its owner
  • BitmapFactory for easy Bitmap loading from Code
  • NEW Custom Styling with the Avalonia Style System. All Element share the class "MessageBox". Have a look at UserThemeExample if you want to do that.

I also expanded the Example Project to show the new API and different Styles.

Installation

You can find the latest version of this Package on NuGet

Example Usage (Default)

var result = await BoxedMessage.Create(new MessageBoxParams
{
	Buttons = ButtonEnum.Ok | ButtonEnum.Abort,
	ContentTitle = "Oh no",
	ContentMessage = "Oh no! Something went wrong :(",
	Location = WindowStartupLocation.CenterScreen,
	Icon = BitmapFactory.Load("avares://MessageBox.Avalonia.Example/Assets/plus.ico"),
	Style = BoxStyle.UbuntuLinux
}).ShowDialogAsync(this);

Example Usage User Style

Available Selector

  • Button.MessageBox
  • Button.MessageBox:pointerover /template/ ContentPresenter
  • Button.MessageBox:pointerover
  • TextBox.MessageBox
  • Window.MessageBox

Example Style Rules

<Style Selector="Button.MessageBox">
    <Setter Property="Foreground" Value="#8fbcbb" />
    <Setter Property="Background" Value="#3b4252" />
    <Setter Property="BorderThickness" Value="2" />
</Style>
<Style Selector="Button.MessageBox:pointerover /template/ ContentPresenter">
    <Setter Property="Background" Value="#eceff4" />
    <Setter Property="BorderBrush" Value="#d8dee9" />
</Style>
<Style Selector="Button.MessageBox:pointerover">
    <Setter Property="Foreground" Value="#3b4252" />
</Style>
<Style Selector="TextBox.MessageBox">
    <Setter Property="Background" Value="#3b4252" />
    <Setter Property="Foreground" Value="#8fbcbb" />
</Style>
<Style Selector="Window.MessageBox">
    <Setter Property="Background" Value="#3b4252" />
</Style>

NOTE: If you want to use this feature you should set the Style Property on your Message Box to None.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.9.8 1,218 7/16/2020
0.9.7 430 7/16/2020