WindowNotificationManager can't be used immediately after creating
See original GitHub issueClick the interface test button, the notification cannot be displayed and the error will be reported directly
@ForNeVeR @mterwoord @vmrocha @lontivero
private void btn_TestClike(object sender, RoutedEventArgs e)
{
WindowNotificationManager _notificationManager = new WindowNotificationManager(this)
{
Position = NotificationPosition.TopRight,
MaxItems = 3
};
_notificationManager.Show(new NotificationModel
{
Title = "1234",
Message = "12345",
Type = NotificationType.Information,
Expiration = TimeSpan.FromSeconds(100000)
});
//NotificationManager.Show(new NotificationModel{
// Title = "Hey There!",
// Message = "Did you know that Avalonia now supports Custom In-Window Notifications?" });
}
public class NotificationModel: INotification
{
public string Title { get; set; }
public string Message { get; set; }
public NotificationType Type { get; set; }
public TimeSpan Expiration { get; set; }
//public Action OnClick { get; set; }
//public Action OnClose { get; set; }
public Action OnClick => () => Console.WriteLine("helloworld");
public Action OnClose => () => Console.WriteLine("Stw");
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Create and manage notification channels
After you create a notification channel, you can't change the notification behaviors. The user has complete control at that point.
Read more >NotificationManager.notify() not launching full-screen intent ...
I have an alarm clock app and since android 10 I have to use full-screen intents to trigger the alarms. When the device...
Read more >Notification Manager in Android
Developers can use the NotificationManager class to create and manage notifications within their apps. To create a notification, ...
Read more >Android Notification, PendingIntent Example
In this tutorial we'll create an application that wraps an intent that would view a webpage, into a PendingIntent.
Read more >How To Make A Simple Notification Manager - Unity Tutorial
In this video series I will show you many tips and tricks that you must know about when it comes do game design,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Probably too late but if anyone facing the same issue, this is the correct way to show it directly as per maxkatz6 instructions
If somebody has the same problem I had. I was initializing it in the MainWindow’s ctor but it did not show for me. Only after moving it to e.g. Window_OnLoaded: