[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Collapse]MVVM Framework
  [Expand]View Models
  [Expand]Commands
  [Expand]Behaviors
  [Collapse]Services
    Getting Started
    Services in ViewModelBase descendants
    Services in POCO objects
    Services in custom ViewModels
    View creation mechanisms
   [Collapse]Predefined Set
    [Expand]Dialog Services
    [Expand]Message Box Services
    [Expand]Document Services
    [Expand]ViewInjectionService
    [Expand]Report Services
     NotificationService
     TaskbarButtonService
     ApplicationJumpListService
     DXSplashScreenService
     DispatcherService
     FrameNavigationService
     LayoutSerializationService
     FolderBrowserDialogService
     OpenFileDialogService
     SaveFileDialogService
     WizardService
     WindowService
     CurrentDialogService
     CurrentWindowService
     NotifyIconService
    How to create a Custom Service
  [Expand]DXBinding
  [Expand]MIF
   Converters
   ViewLocator
   Messenger
   Data Annotation Attributes
   LayoutTreeHelper
   Weak Event
 [Expand]Controls and Libraries
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

NotificationService

The NotificationService allows you to display popup notifications in your applications. You can use the native Windows 8/10 look & feel or create a custom template.

Expanded Create Windows 8/10 Native Notification

To display a Windows 8/10 native notification, specify the following NotificationService properties:

Place the NotificationService into the Interaction.Behaviors collection and define your View Model's NotificationService as a POCO object.

Note

When View Model is inherited from the ViewModelBase, use the Services in ViewModelBase descendants topic approach.

Expanded Create a Custom Notification

The NotificationService uses its own notification mechanism to create a custom notification.

Use the NotificationService.CustomNotificationTemplate property to define a custom notification layout.

To create a custom notification, use the NotificationService.CreateCustomNotification method. This method requires a notification's View Model as a parameter.

Use the INotification.ShowAsync method to display the created notification. This method returns a NotificationResult enumeration value depending on how the notification is displayed and which notification element an end user clicks. The ShowAsync method returns the following values depending on the notification result:

  • Activated, if a user clicks the notification.
  • UserCanceled, if a user clicks the notification's close button.
  • TimedOut, if a user does not click the notification during the time specified in the NotificationService.CustomNotificationDuration or NotificationService.PredefinedNotificationDuration property.
  • ApplicationHidden, if you use the INotification.Hide method when the notification is displayed.
  • Dropped, if the system's notification queue is full and the notification cannot be displayed.

The code snippet below illustrates how to process the ShowAsync method's result.

Expanded NotificationService Sample Project

Is this topic helpful?​​​​​​​