Blazor Notification System
Installation
Install the
Dignite.Abp.NotificationCenter.Blazor
NuGet package into your Blazor project.Add
DigniteAbpNotificationCenterBlazorModule
to the[DependsOn(...)]
property list of the module class.Install the
Dignite.Abp.NotificationCenter.Blazor.Server
NuGet package into your Blazor.Server project.Add
DigniteAbpNotificationCenterBlazorServerModule
to the[DependsOn(...)]
property list of the module class.
Notification Components
Each notification component consists of a notification icon component and a notification data component:
Create a notification icon component
Create a Blazor component by inheriting from the
NotificationIconComponentBase
abstract class.NotificationName
: The notification name set in Define a Notification.@using Dignite.Abp.Notifications.Components; @using NotificationCenterSample.Notifications; @inherits NotificationIconComponentBase <Icon Name="IconName.Grin" IconSize="IconSize.Large" TextColor="TextColor.Primary"></Icon> @code { public override string NotificationName { get; } = NotificationCenterSampleNotifications.TestNotification; }
If there is no corresponding icon component for the notification name, the system will use the default icon component.
Create a notification data component
Create a Blazor component by inheriting from the
NotificationDataComponentBase<TNotificationData>
abstract class.TNotificationData
: The type inherited from theNotificationData
abstract class.The system provides components for two notification data types:
MessageNotificationData
andLocalizableMessageNotificationData
.Example of a notification data component for the
MessageNotificationData
notification data type:@using Dignite.Abp.Notifications @inherits NotificationDataComponentBase<MessageNotificationData> <Paragraph Style="min-width:300px;"> @NotificationData.Message </Paragraph>
Sample
Download the sample from GitHub and follow the instructions to experience the Blazor version of the notification system.