Close Notifications using the NotificationService #63

Closed
opened 2026-01-29 17:30:56 +00:00 by claunia · 3 comments
Owner

Originally created by @Stjin on GitHub (Mar 19, 2021).

Is your feature request related to a problem? Please describe.
My issue is not related to a problem, however currently it is only possible to create and Notify a message without manually closing the notification programmatically. This can become a problem when you use the notification to permanently show a status for an async task (such as "Changing status..." or something) .It would be great to hide/close the notification programmatically.

Describe the solution you'd like
I would like to see something like NotificationService.Close(message); or message.Close();

Describe alternatives you've considered
I cannot think of any alternative as async (network) requests don't have a specific duration.

Additional context
I feel like adding a .Close(); method is a basic functionality that would definitely improve the Notification component

Originally created by @Stjin on GitHub (Mar 19, 2021). **Is your feature request related to a problem? Please describe.** My issue is not related to a problem, however currently it is only possible to create and Notify a message without manually closing the notification programmatically. This can become a problem when you use the notification to permanently show a status for an async task (such as "Changing status..." or something) .It would be great to hide/close the notification programmatically. **Describe the solution you'd like** I would like to see something like `NotificationService.Close(message);` or `message.Close();` **Describe alternatives you've considered** I cannot think of any alternative as async (network) requests don't have a specific duration. **Additional context** I feel like adding a .Close(); method is a basic functionality that would definitely improve the Notification component
Author
Owner

@enchev commented on GitHub (Mar 22, 2021):

Hey @Stjin,

NotificationService.Messages is ObservableCollection and if you execute Clear() all messages will be removed:
https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenNotification.razor#L30

@enchev commented on GitHub (Mar 22, 2021): Hey @Stjin, NotificationService.Messages is ObservableCollection<T> and if you execute Clear() all messages will be removed: https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenNotification.razor#L30
Author
Owner

@Stjin commented on GitHub (Mar 22, 2021):

Hey @Stjin,

NotificationService.Messages is ObservableCollection and if you execute Clear() all messages will be removed:
https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenNotification.razor#L30

How did I miss that, thanks for your quick reply!

@Stjin commented on GitHub (Mar 22, 2021): > Hey @Stjin, > > NotificationService.Messages is ObservableCollection and if you execute Clear() all messages will be removed: > https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenNotification.razor#L30 How did I miss that, thanks for your quick reply!
Author
Owner

@Stjin commented on GitHub (Mar 22, 2021):

@enchev I noticed NotificationService.Messages.Remove(message); is not removing the passed notification. Is this expected behaviour?

@Stjin commented on GitHub (Mar 22, 2021): @enchev I noticed NotificationService.Messages.Remove(message); is not removing the passed notification. Is this expected behaviour?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#63