Wpf.NotificationCenter 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Wpf.NotificationCenter --version 1.0.1                
NuGet\Install-Package Wpf.NotificationCenter -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wpf.NotificationCenter" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wpf.NotificationCenter --version 1.0.1                
#r "nuget: Wpf.NotificationCenter, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Wpf.NotificationCenter as a Cake Addin
#addin nuget:?package=Wpf.NotificationCenter&version=1.0.1

// Install Wpf.NotificationCenter as a Cake Tool
#tool nuget:?package=Wpf.NotificationCenter&version=1.0.1                

Wpf.NotificationCenter

<img src="Resources/image-3.png" alt="Image of an error expanded in the notification center" width="200" />

Objective

  • Create Toast Notifications
  • Create Alerts for the notification Center
  • Read previous alerts / toasts in one place.
  • Unread indicator
  • Customizable

Contents

Installation

Install NuGet Package (Wpf.NotificationCenter)

Choose one:

  • .NET CLI
    • dotnet add package Wpf.NotificationCenter --version 1.0.0
  • Package Manager
    • NuGet\Install-Package Wpf.NotificationCenter -Version 1.0.0
  • Package Reference
    • <PackageReference Include="Wpf.NotificationCenter" Version="1.*" />
  • Paket CLI
    • paket add Wpf.NotificationCenter --version 1.0.0
  • Script & Interactive
    • #r "nuget: Wpf.NotificationCenter, 1.0.0"
  • Cake
    • Install Wpf.NotificationCenter as a Cake Addin
      • #addin nuget:?package=Wpf.NotificationCenter&version=1.0.0
    • Install Wpf.NotificationCenter as a Cake Tool
      • #tool nuget:?package=Wpf.NotificationCenter&version=1.0.0

MainWindow.xaml (Add Notification Center)

  • Add namespace

    xmlns:notificationCenter="clr-namespace:Wpf.NotificationCenter;assembly=Wpf.NotificationCenter"
    
  • Include theme resource dictionary

    <ResourceDictionary Source="pack://application:,,,/Wpf.NotificationCenter;component/Themes/Generic.xaml" />
    
  • Add Notification Center with content inside.

    <notificationCenter:NotificationCenter
          x:Name="NotificationCenter"
          VerticalAlignment="Stretch"
          HorizontalAlignment="Stretch"
          NewAlertColor="GoldenRod"
          NoAlertColor="Gray"
          AlertMaxWidth="175"
          MaxNotifications="10"
          BorderBrush="Blue"
          AlertButtonBackground="#27252F"
          IsItemsAscending="False">
          <notificationCenter:NotificationCenter.Header>
    
              <c:MainNavMenu Grid.Row="0" Navigate="{Binding DataContext.NavigateCommand, RelativeSource={RelativeSource AncestorType={x:Type c:MainWindow}}}"
                                          ViewContext="{Binding DataContext.ViewContext, RelativeSource={RelativeSource AncestorType={x:Type c:MainWindow}}}" />
          </notificationCenter:NotificationCenter.Header>
          <notificationCenter:NotificationCenter.Content>
              <Grid>
    
              </Grid>
          </notificationCenter:NotificationCenter.Content>
    </notificationCenter:NotificationCenter> ```
    
    

App.xaml.cs (update the services collection)

  • Add using statement

    using Wpf.NotificationCenter.Extensions;
    
  • Add the services to the collection:

    services.UseWpfNotificationCenter();
    

Example Images

Notification Center resides in the header. Toast notifications can be shown.
<img src="Resources/image-8.png" alt="Image of the notification center residing in the header" width="200" /> <img src="Resources/image-1.png" alt="Image of an error toast notification" width="200" />
Alert center Notification with collapsed message. Alert center Notification with expanded message.
<img src="Resources/image-2.png" alt="Image of an error collapsed in the notification center" width="200" /> <img src="Resources/image-3.png" alt="Image of an error expanded in the notification center" width="200" />
An extra long message will automatically be collapsed, indicated by the ellipses. An extra long message can be expanded by clicking on the collapsed message.
<img src="Resources/image-5.png" alt="Image of collapsed extra long message" width="200" /> <img src="Resources/image-6.png" alt="Image of expanded extra long message" width="200" />

Customization

Notification Center Element Properties

Property Value Type Default Inherited Description
AlertButtonBackground Brushes Transparent False The background of the header that is not in the provided content (alert button area).
AlertMaxWidth Double Auto False The alert maximum width property of the notification center popup.
AlertMaxHeight Double 150 False The alert text content maximum height in the alert center.
BorderBrush="Blue" Brushes Transparent True Used for line colors in notification center and / or headers.
IsItemsAscending Boolean False False Indicates the order of alerts in the notification center.
MaxNotifications Byte 0 (Unlimited) False The upper limit of notifications allowed in the alert center. Oldest are removed when this number is exceeded.
NewAlertColor Brushes Goldenrod False Color of the icon when there is a new alert.
NewAlertIcon PackIconKind BellAlert False The icon when there is a new alert.
NoAlertColor Brushes Black False Color of the icon when there are no unread alerts.
NoAlertIcon PackIconKind Notifications False The icon when there are no unread alerts.
Example

See usage in main window section.

Detailed Customization Theme File

Most of the look / feel is defined in the generic.xaml file. Primary theme styles are inherited from the theme of the site.

Click here to view the theme - generic.xaml

API Documentation

API Documentation

Release Notes

  • Initial Release - v.1.0.0
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net7.0-windows7.0 is compatible.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.5 276 10/30/2023
1.1.4 153 10/24/2023
1.1.0 166 10/23/2023
1.0.1 135 10/20/2023
1.0.0 152 10/17/2023