Notifications.Wpf.Sarav 0.1.0

dotnet add package Notifications.Wpf.Sarav --version 0.1.0
NuGet\Install-Package Notifications.Wpf.Sarav -Version 0.1.0
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="Notifications.Wpf.Sarav" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Notifications.Wpf.Sarav --version 0.1.0
#r "nuget: Notifications.Wpf.Sarav, 0.1.0"
#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 Notifications.Wpf.Sarav as a Cake Addin
#addin nuget:?package=Notifications.Wpf.Sarav&version=0.1.0

// Install Notifications.Wpf.Sarav as a Cake Tool
#tool nuget:?package=Notifications.Wpf.Sarav&version=0.1.0

Notifications.Wpf

WPF toast notifications.

Demo

Installation:

Install-Package Notifications.Wpf

Usage:

Notification over the taskbar:
var notificationManager = new NotificationManager();

notificationManager.Show(new NotificationContent
           {
               Title = "Sample notification",
               Message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
               Type = NotificationType.Information
           });
Notification inside application window:
  • Adding namespace:
xmlns:notifications="clr-namespace:Notifications.Wpf.Controls;assembly=Notifications.Wpf"
  • Adding new NotificationArea:
<notifications:NotificationArea x:Name="WindowArea" Position="TopLeft" MaxItems="3"/>
  • Displaying notification:
notificationManager.Show(
                new NotificationContent {Title = "Notification", Message = "Notification in window!"},
                areaName: "WindowArea");
Simple text with OnClick & OnClose actions:
notificationManager.Show("String notification", onClick: () => Console.WriteLine("Click"),
               onClose: () => Console.WriteLine("Closed!"));

Caliburn.Micro MVVM support:

  • App.xaml:
xmlns:controls="clr-namespace:Notifications.Wpf.Controls;assembly=Notifications.Wpf"

<Application.Resources>
    [...]
    <Style TargetType="controls:Notification">
        <Style.Resources>
            <DataTemplate DataType="{x:Type micro:PropertyChangedBase}">
                <ContentControl cal:View.Model="{Binding}"/>
            </DataTemplate>
        </Style.Resources>
    </Style>
</Application.Resources>
  • ShellViewModel:
var content = new NotificationViewModel(_manager)
{
    Title = "Custom notification.",
    Message = "Click on buttons!"
};

_manager.Show(content, expirationTime: TimeSpan.FromSeconds(30));
  • NotificationView:
<DockPanel LastChildFill="False">
    
    <Button x:Name="Ok" Content="Ok" DockPanel.Dock="Right" controls:Notification.CloseOnClick="True"/>
    <Button x:Name="Cancel" Content="Cancel" DockPanel.Dock="Right" Margin="0,0,8,0" controls:Notification.CloseOnClick="True"/>
</DockPanel>
  • Result:

Demo

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
0.1.0 640 6/9/2019

First release.