Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.0.0] Can't inherit INotification #12134

Closed
vadd98 opened this issue Jul 10, 2023 · 2 comments · Fixed by #12178
Closed

[11.0.0] Can't inherit INotification #12134

vadd98 opened this issue Jul 10, 2023 · 2 comments · Fixed by #12178

Comments

@vadd98
Copy link

vadd98 commented Jul 10, 2023

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?

@vadd98 vadd98 added the bug label Jul 10, 2023
@timunie
Copy link
Contributor

timunie commented Jul 11, 2023

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?

@vadd98
Copy link
Author

vadd98 commented Jul 11, 2023

I think that would be awesome as in that case I wouldn't have to manage these parameters in the custom control

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants