Movere is an implementation of managed dialogs for Avalonia.
MIT License
Movere is an implementation of managed dialogs for Avalonia. Currently there are message dialogs, as well as open and save file dialogs, and a print dialog (based on System.Drawing.Printing
) is WIP.
To use Avalonia system dialog APIs, it's possible to simply register Movere dialogs with AppBuilder
:
Movere
namespace:using Movere;
UseMovere
to AppBuilder
configuration. Example:AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseMovere();
var dialog = new OpenFileDialog();
var result = await dialog.ShowAsync(parent);
To simply use the dialogs (this example is for message dialogs, but it's similar for others):
Window
(owner):var messageDialogService = new MessageDialogService(owner);
window.DataContext = new ViewModel(messageDialogService);
private Task ShowInfoAsync() =>
_messageDialogService.ShowMessageDialogAsync(
new MessageDialogOptions(
DialogIcon.Info,
"Message Dialog",
"Some info",
DialogResultSet.OK));
Available icons are:
DialogIcon.None
DialogIcon.Info
DialogIcon.Warning
DialogIcon.Error
To add your own icon, just create an instance of DialogIcon
and pass the resource string, e.g avares://My.App/Resources/Icons/MyIcon.png
.
Dialog results are extensible as well, and support localization.