Skip to content

Getting started

mohamed magdy edited this page Dec 17, 2016 · 4 revisions

Step by step guide to display the toast notification with the default style.

1) Adding the Notification assembly

  • Get the latest WPFToastNotification release and unzip its contents to disk or install the WPFNotification package using NuGet.
  • Open Visual Studio and open an existing WPF application or create a new WPF Application project.
  • Add an assembly reference to WPFNotification.dll
  • Modify the App.xaml and add the following resource dictionary reference:

` <Application.Resources>

 <ResourceDictionary>
   <ResourceDictionary.MergedDictionaries>
             <ResourceDictionary Source="/WPFNotification;component/Assets/NotificationUI.xaml" />
         </ResourceDictionary.MergedDictionaries>
 </ResourceDictionary>

</Application.Resources>`

notice that : If you install WPFNotification package using NuGet, Automatically it will add the assembly reference and modify App.xaml for you.

2) Display Notification

  • If you are using MVVM pattern you need to do the following steps:
    • Inject INotificationDialogService into your viewModel.
    • Create Notification object with your Title, Message and optional ImgURL (if null it will display the default predefined image).
    • Finally call the NotificationDialogServiceObject.ShowNotificationWindow(NotificationObject) method with notification object.
  • If you are using Code-Behind you need to do the following steps:
    • Create INotificationDialogService object.
    • Create Notification object with your Title, Message and optional ImgURL (if null it will display the default predefined image).
    • Finally call the NotificationDialogServiceObject.ShowNotificationWindow(NotificationObject) method with notification object.

Clone this wiki locally