Class NotificationService
Class NotificationService. Contains various methods with options to open notifications. Should be added as scoped service in the application services and RadzenNotification should be added in application main layout.
Inheritance
Namespace: Radzen
Assembly: Radzen.Blazor.dll
Syntax
public class NotificationService : object
Examples
@inject NotificationService NotificationService
<RadzenButton Text="Show info notification" Click=@(args => NotificationService.Notify(new NotificationMessage { Severity = NotificationSeverity.Info, Summary = "Info Summary", Detail = "Info Detail", Duration = 4000 })) / >
Properties
Messages
Gets the messages.
Declaration
public ObservableCollection<NotificationMessage> Messages { get; }
Property Value
Type | Description |
---|---|
ObservableCollection<NotificationMessage> | The messages. |
Methods
Notify(NotificationMessage)
Notifies the specified message.
Declaration
public void Notify(NotificationMessage message)
Parameters
Type | Name | Description |
---|---|---|
NotificationMessage | message | The message. |
Notify(NotificationSeverity, String, String, Double, Action<NotificationMessage>, Boolean, Object, Action<NotificationMessage>)
Notifies the specified severity.
Declaration
public void Notify(NotificationSeverity severity = NotificationSeverity.Info, string summary = "", string detail = "", double duration = null, Action<NotificationMessage> click = null, bool closeOnClick = false, object payload = null, Action<NotificationMessage> close = null)
Parameters
Type | Name | Description |
---|---|---|
NotificationSeverity | severity | The severity. |
System.String | summary | The summary. |
System.String | detail | The detail. |
System.Double | duration | The duration. |
Action<NotificationMessage> | click | The click event. |
System.Boolean | closeOnClick | If true, then the notification will be closed when clicked on. |
System.Object | payload | Used to store a custom payload that can be retreived later in the click event handler. |
Action<NotificationMessage> | close | Action to be executed on close. |