Class NotificationService
- Namespace
- Radzen
- Assembly
- Radzen.Blazor.dll
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.
public class NotificationService
- Inheritance
-
NotificationService
- Inherited Members
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 })) / >
Constructors
NotificationService()
public NotificationService()
Properties
Messages
Gets the messages.
public ObservableCollection<NotificationMessage> Messages { get; }
Property Value
- ObservableCollection<NotificationMessage>
The messages.
Methods
Notify(NotificationMessage)
Notifies the specified message.
public void Notify(NotificationMessage message)
Parameters
message
NotificationMessageThe message.
Notify(NotificationSeverity, string, string, double, Action<NotificationMessage>, bool, object, Action<NotificationMessage>)
Notifies the specified severity.
public void Notify(NotificationSeverity severity = NotificationSeverity.Info, string summary = "", string detail = "", double duration = 3000, Action<NotificationMessage> click = null, bool closeOnClick = false, object payload = null, Action<NotificationMessage> close = null)
Parameters
severity
NotificationSeverityThe severity.
summary
stringThe summary.
detail
stringThe detail.
duration
doubleThe duration.
click
Action<NotificationMessage>The click event.
closeOnClick
boolIf true, then the notification will be closed when clicked on.
payload
objectUsed to store a custom payload that can be retreived later in the click event handler.
close
Action<NotificationMessage>Action to be executed on close.