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.

Toolbox icon: πŸ””
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 ValueDescription
ToastNotificationFloating toast message with icon and optional dismiss button.
AlertBannerFull-width coloured banner for important messages.
ProgressAlertBanner with integrated progress bar and status text.
StatusCardCard with large status icon, title, and detail message.
MessageCenterCompact message centre showing notification count and preview.
SystemAlertHigh-priority system status alert with severity colour.
ValidationMessageForm validation feedback with field-level error/warning/success.
InfoPanelInformational panel with expandable detail area.
WarningBadgeSmall badge/chip suitable for inline warning indicators.
SuccessBannerCompact success confirmation strip.

Properties

PropertyTypeDefaultDescription
StyleNotificationWidgetStyleToastNotificationSelects the notification painter.
NotificationTypeNotificationTypeInfoInfo, Success, Warning, Error, or Progress β€” drives icon and colour.
Titlestring"Notification"Heading text.
Messagestring"This is a notification message"Body/detail text.
ActionTextstring"Action"Label on the optional action button.
IsDismissiblebooltrueShow/hide the dismiss (Γ—) button.
ShowIconbooltrueShow/hide the type icon.
ShowActionboolfalseShow/hide the action button.
Progressint00–100 progress value used by ProgressAlert style.
TimestampDateTimeDateTime.NowTimestamp rendered in MessageCenter and ActivityStream styles.

Inherits all BaseControl properties (Border, Padding, Theme colors, etc.).

Events

EventArgs TypeDescription
NotificationClickedBeepEventDataArgsFired when the notification body is clicked.
ActionClickedBeepEventDataArgsFired when the action button is clicked.
DismissClickedBeepEventDataArgsFired 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 Style before adding the widget to the form to avoid double repaints.
  • Adjust Size to fit your layout β€” defaults are minimum comfortable sizes.
  • Read BeepEventDataArgs.Data in 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.