Table of Contents

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 NotificationMessage

The 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 NotificationSeverity

The severity.

summary string

The summary.

detail string

The detail.

duration double

The duration.

click Action<NotificationMessage>

The click event.

closeOnClick bool

If true, then the notification will be closed when clicked on.

payload object

Used to store a custom payload that can be retreived later in the click event handler.

close Action<NotificationMessage>

Action to be executed on close.