Avalonia
Avalonia copied to clipboard
[11.0.0] Can't inherit INotification
Describe the bug I'm migrating my app from 0.10 to 11. In 0.10 I have a custom NotificationCard which inherited UserControl and INotification, in this way I created a custom template but keeping the possibility to set notification parameters like the expiration timeout. From 11 INotification is not implementable anymore, so now my custom NotificationCard is just a UserControl. It is displayed as it should, by the way there is no way to set notification parameters (NotificationType, Expiration, ...).
Is there another way to customize a NotificationCard with Avalonia 11?
I think implementing INotification
is kind of a "hidden" feature and was never inteded to be done by the user. Doesn't also bring much benefit, as most users don't know about it. Also it's quite verbose to implement. Instead, let me propose a more flexible API for it. In NotificationManager
, we should add a new overload for Show()
which accepts the needed parameters
_manager.Show(object? content,
NotificationType type = NotificationType.Information,
TimeSpan? expiration = null,
Action? onClick = null,
Action? onClose = null);
what do you think, would it be an option for you?
I think that would be awesome as in that case I wouldn't have to manage these parameters in the custom control