Avalonia Css
Source CodeδΈ­ζ–‡
  • Documentation
    • πŸŽ†Welcome
    • πŸŒοΈβ€β™‚οΈGet started
      • About Acss
      • Processes and concepts
      • Security
      • Performance Evaluation
      • Configuring the development environment
      • Debugging
      • About source code
      • FAQ
    • ❓How-to
      • Using Acss
        • Type Resolution
        • Configuration
        • Code Source
        • Extending Resources
      • Using Acss.Controls
      • Using Acss.Fluent
      • Using MessageBox
      • Using Senior
      • Using Acss.Behaviors
    • πŸ“Acss Syntax
      • Comment
      • Resource
      • Style
      • Animation
      • Behavior
    • πŸ’ŽBest Practices
      • Define a good control template
Powered by GitBook
On this page
  • Installation
  • Using standalone styled MessageBox
  • Using Acss-based MessageBox
  • Using custom styles
  • Samples

Was this helpful?

Edit on GitHub
  1. Documentation
  2. How-to

Using MessageBox

Installation

dotnet add package Nlnet.Avalonia.MessageBox --version 1.0.0-beta.4

Using standalone styled MessageBox

  • Import resource.

<ResourceInclude Source="avares://Nlnet.Avalonia.MessageBox/Assets/Themes.axaml" />
  • Synchronised use.

// WPF Standard: call messagebox synchronous.
private void OnClick(object? sender, RoutedEventArgs e)
{
    var result = MessageBox.Show("Hello, this is Nlnet MessageBox!", 
        "Welcome", Buttons.OkCancel, Images.Info);
    
    TbxResult.Text = result.ToString();
}
  • Asynchronous use.

// Avalonia Standard: call messagebox asynchronous.
private async void OnClick(object? sender, RoutedEventArgs e)
{
    var result  = await MessageBox.ShowAsync("Hello, this is Nlnet MessageBox :)", 
         "Welcome", Buttons.OkCancel, Images.Info);
    
    TbxResult.Text = result.ToString();
}

Using Acss-based MessageBox

The difference with standalone MessageBox styles is that Acss-based styles load different style resources. There is no difference in the way it is called.

<ResourceInclude 
    Source="avares://Nlnet.Avalonia.MessageBox/Assets/Themes.Acss.axaml" />

Using custom styles

You can still customise the theme and style of the MessageBox, in the same way as overriding the theme style of other Avalonia controls/windows.

Samples

PreviousUsing Acss.FluentNextUsing Senior

Last updated 1 year ago

Was this helpful?

We provide standalone MessageBox example code, visit it on .

❓
Github