To start you should install NuGet package
Install-Package Notification.Avalonia
or download https://www.nuget.org/packages/Notification.Avalonia/ repo.
For use:
- Add style in App.xaml
<Application.Styles>
...
<StyleInclude Source="avares://Notification.Avalonia/Themes/Generic.xaml" />
</Application.Styles>
- Add notification panel in your window
<Border Grid.Column="1">
<controls:NotificationMessageContainer Manager="{Binding Manager}" />
</Border>
- Bind manager from vm
public INotificationMessageManager Manager { get; } = new NotificationMessageManager();
- Run notification
this.Manager
.CreateMessage()
.Accent("#1751C3")
.Animates(true)
.Background("#333")
.HasBadge("Info")
.HasMessage(
"Update will be installed on next application restart. This message will be dismissed after 5 seconds.")
.Dismiss().WithButton("Update now", button => { })
.Dismiss().WithButton("Release notes", button => { })
.Dismiss().WithDelay(TimeSpan.FromSeconds(5))
.Queue();