Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/Federerer/Notifications.Wpf

Toast notifications for WPF
https://github.com/Federerer/Notifications.Wpf

Last synced: 13 days ago
JSON representation

Toast notifications for WPF

Lists

README

        

# Notifications.Wpf
WPF toast notifications.

![Demo](http://i.imgur.com/UvYIVFV.gif)
### Installation:
```
Install-Package Notifications.Wpf
```
### Usage:

#### Notification over the taskbar:
```C#
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:
```XAML
xmlns:notifications="clr-namespace:Notifications.Wpf.Controls;assembly=Notifications.Wpf"
```
- Adding new NotificationArea:
```XAML

```
- Displaying notification:
```C#
notificationManager.Show(
new NotificationContent {Title = "Notification", Message = "Notification in window!"},
areaName: "WindowArea");
```

#### Simple text with OnClick & OnClose actions:
```C#
notificationManager.Show("String notification", onClick: () => Console.WriteLine("Click"),
onClose: () => Console.WriteLine("Closed!"));
```
### Caliburn.Micro MVVM support:
- App.xaml:
```XAML
xmlns:controls="clr-namespace:Notifications.Wpf.Controls;assembly=Notifications.Wpf"

[...]

<Style.Resources>
<DataTemplate DataType="{x:Type micro:PropertyChangedBase}">
<ContentControl cal:View.Model="{Binding}"/>
</DataTemplate>

```
- ShellViewModel:
```C#
var content = new NotificationViewModel(_manager)
{
Title = "Custom notification.",
Message = "Click on buttons!"
};

_manager.Show(content, expirationTime: TimeSpan.FromSeconds(30));
```
- NotificationView:
```XAML



```
- Result:

![Demo](http://i.imgur.com/G1ZU2ID.gif)