BeepNotificationWidget
Alert and notification widget with ten styles: toast, banner, progress alert, status card, message centre, system alert, validation message, info panel, warning badge, and success banner.
Overview
BeepNotificationWidget is a paint-based WinForms widget that inherits from BaseControl. It uses an IWidgetPainter pipeline to render rich visuals without child controls. The Style property selects one of 10 built-in render modes; changing it at runtime immediately swaps the painter and triggers a repaint.
Category: Beep Widgets β Alerts / Notifications
Default size: 350 Γ 80
Namespace: TheTechIdea.Beep.Winform.Controls.Widgets
Key Features
π Ten Notification Styles
Toast, banner, badge, validation β every common alert pattern covered.
π¨ Type-Driven Colors
NotificationType drives accent colour automatically (green=success, red=errorβ¦).
π Progress Integration
ProgressAlert style shows live progress for background operation feedback.
β Validation Feedback
ValidationMessage style targets form field validation use-cases.
π« Dismissible
IsDismissible toggles the Γ button; DismissClicked fires when pressed.
β‘ Action Button
ShowAction + ActionText expose a one-click CTA directly in the notification.
Style Variants (10)
| Style Value | Description |
|---|---|
ToastNotification | Floating toast message with icon and optional dismiss button. |
AlertBanner | Full-width coloured banner for important messages. |
ProgressAlert | Banner with integrated progress bar and status text. |
StatusCard | Card with large status icon, title, and detail message. |
MessageCenter | Compact message centre showing notification count and preview. |
SystemAlert | High-priority system status alert with severity colour. |
ValidationMessage | Form validation feedback with field-level error/warning/success. |
InfoPanel | Informational panel with expandable detail area. |
WarningBadge | Small badge/chip suitable for inline warning indicators. |
SuccessBanner | Compact success confirmation strip. |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
Style | NotificationWidgetStyle | ToastNotification | Selects the notification painter. |
NotificationType | NotificationType | Info | Info, Success, Warning, Error, or Progress β drives icon and colour. |
Title | string | "Notification" | Heading text. |
Message | string | "This is a notification message" | Body/detail text. |
ActionText | string | "Action" | Label on the optional action button. |
IsDismissible | bool | true | Show/hide the dismiss (Γ) button. |
ShowIcon | bool | true | Show/hide the type icon. |
ShowAction | bool | false | Show/hide the action button. |
Progress | int | 0 | 0β100 progress value used by ProgressAlert style. |
Timestamp | DateTime | DateTime.Now | Timestamp rendered in MessageCenter and ActivityStream styles. |
Inherits all BaseControl properties (Border, Padding, Theme colors, etc.).
Events
| Event | Args Type | Description |
|---|---|---|
NotificationClicked | BeepEventDataArgs | Fired when the notification body is clicked. |
ActionClicked | BeepEventDataArgs | Fired when the action button is clicked. |
DismissClicked | BeepEventDataArgs | Fired when the dismiss (Γ) button is clicked. |
Basic Usage
// Inline error for a form field
var validation = new BeepNotificationWidget
{
Style = NotificationWidgetStyle.ValidationMessage,
NotificationType = NotificationType.Error,
Title = "Email Invalid",
Message = "Please enter a valid email address.",
IsDismissible = false,
ShowIcon = true,
Size = new Size(380, 50)
};
emailPanel.Controls.Add(validation);
// Progress alert during a long operation
var progress = new BeepNotificationWidget
{
Style = NotificationWidgetStyle.ProgressAlert,
NotificationType = NotificationType.Progress,
Title = "Importing data...",
Progress = 0,
IsDismissible = false
};
statusPanel.Controls.Add(progress);
// Update in background worker:
progress.Progress = 45;
progress.Invalidate();
Event Handling
notification.ActionClicked += (s, e) => OpenNotificationCenter();
notification.DismissClicked += (s, e) =>
{
notification.Visible = false;
};
Best Practices
- Set
Stylebefore adding the widget to the form to avoid double repaints. - Adjust
Sizeto fit your layout β defaults are minimum comfortable sizes. - Read
BeepEventDataArgs.Datain event handlers for context-specific click data. - Call
Invalidate()after updating data properties to trigger a repaint. - Let theme colors flow from
BeepStyling.CurrentThemeβ avoid overriding color properties unless customization is explicitly desired.