Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avaloniacommunity/messagebox.avalonia
Messagebox for AvaloniaUI
https://github.com/avaloniacommunity/messagebox.avalonia
avalonia avaloniaui dotnet messagebox nuget
Last synced: 1 day ago
JSON representation
Messagebox for AvaloniaUI
- Host: GitHub
- URL: https://github.com/avaloniacommunity/messagebox.avalonia
- Owner: AvaloniaCommunity
- License: mit
- Created: 2019-11-06T15:01:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-27T17:57:23.000Z (about 2 months ago)
- Last Synced: 2024-12-21T04:03:54.503Z (1 day ago)
- Topics: avalonia, avaloniaui, dotnet, messagebox, nuget
- Language: C#
- Homepage:
- Size: 2.38 MB
- Stars: 463
- Watchers: 6
- Forks: 57
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MessageBox.Avalonia
Messagebox for AvaloniaUI
Now support all platforms as Xplat templateTo start you should install MessageBox.Avalonia NuGet package
> dotnet add package MessageBox.Avalonia[![nuget](https://img.shields.io/badge/nuget-blue)](https://www.nuget.org/packages/MessageBox.Avalonia/)
or download this repo.[![nuget](https://img.shields.io/nuget/dt/MessageBox.Avalonia?color=blue&label=downloads)](https://www.nuget.org/packages/MessageBox.Avalonia/)
---
---
The easiest way to get started is this:
![](Images/standart-messagebox.png)
```cs
var box = MessageBoxManager
.GetMessageBoxStandard("Caption", "Are you sure you would like to delete appender_replace_page_1?",
ButtonEnum.YesNo);var result = await box.ShowAsync();
```
You have a lot of options how to show your messagebox:`ShowAsync` - Show messagebox depending on the type of application
If application is SingleViewApplicationLifetime (Mobile or Browses) then show messagebox as popup
If application is ClassicDesktopStyleApplicationLifetime (Desktop) then show messagebox as window`ShowWindowAsync` - Show messagebox as window
`ShowWindowDialogAsync` - Show messagebox as window with owner
`ShowAsPopupAsync` - Show messagebox as popup
HyperLink with powerfull options:
```cs
MessageBoxManager.GetMessageBoxCustom(
new MessageBoxCustomParams
{
ButtonDefinitions = new List
{
new ButtonDefinition { Name = "Yes", },
new ButtonDefinition { Name = "No", },
new ButtonDefinition { Name = "Cancel", }
},
ContentTitle = "title",
ContentMessage = "Informative note:" +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ut pulvinar est, eget porttitor magna. Maecenas nunc elit, pretium nec mauris vel, cursus faucibus leo. Mauris consequat magna vel mi malesuada semper. Donec nunc justo, rhoncus vel viverra a, ultrices vel nibh. Praesent ut libero a nunc placerat vulputate. Morbi ullamcorper pharetra lectus, ut lobortis ex consequat sit amet. Vestibulum pellentesque quam at justo hendrerit, et tincidunt nisl mattis. Curabitur eu nibh enim.\n",
Icon = MsBox.Avalonia.Enums.Icon.Question,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
CanResize = false,
MaxWidth = 500,
MaxHeight = 800,
SizeToContent = SizeToContent.WidthAndHeight,
ShowInCenter = true,
Topmost = false,
HyperLinkParams = new HyperLinkParams
{
Text = "https://docs.avaloniaui.net/",
Action = new Action(() =>
{
var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var url = "https://docs.avaloniaui.net/";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
//https://stackoverflow.com/a/2796367/241446
using var proc = new Process { StartInfo = { UseShellExecute = true, FileName = url } };
proc.Start();return;
}if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("x-www-browser", url);
return;
}if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
throw new Exception("invalid url: " + url);
Process.Start("open", url);
return;
})
}
});
```**Markdown support**
Do enable markdown support users need to:
- install MessageBox.Avalonia.Markdown package
- add MarkdownView from :MsBox.Avalonia.Markdown to App.axaml
```
```---
Support: https://t.me/Avalonia
---
**Patrons:**
---
**Powered by**