Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[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]Common Concepts
 [Collapse]MVVM Framework
  [Expand]ViewModels
  [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
     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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

NotifyIconService

NotifyIconService is an INotifyIconService implementation that allows you to place a notification icon (system tray icon) in the Windows notification area and manage its behavior.

Expanded Getting Started

To display a tray icon in the Windows notification area, attach the NotifyIconService to your View. The most straightforward way to attach a service is to use the Smart Tag as described in Attaching MVVM Behaviors and Services. Alternatively, you can do this manually as shown in the code snippet below.

By default, the NotifyIconService's notification icon displays the image specified within the NotifyIconService.Icon property. If you're going to display multiple images depending on certain conditions, use the NotifyIconService's notification states.

When the NotifyIconService's tray icon is left clicked, the NotifyIconService executes the command specified in the NotifyIconService.LeftClickCommand property. In addition to LeftClickCommand, you can assign a context menu to the tray icon.

Expanded Notification States

The NotifyIconService's Notification State is an instance of the NotifyIconState class that provides the Icon and ToolTip properties specifying the tray icon's image and tooltip respectively. Notification States are stored within the NotifyIconService.States property.

To switch between the predefined states, use the INotifyIconService.SetStatusIcon method. If you wish to reset the notification icon to the default image, use the INotifyIconService.ResetStatusIcon method. To learn how to obtain the NotifyIconService if the ViewModel is a POCO object, see Services in POCO objects. If it's a ViewModelBase descendant, refer to Services in ViewModelBase descendants.

Note

The NotifyIconService recognizes states by their names, so each state should have a unique name.

You can also pass an object of the Icon type as the SetStatusIcon method's parameter. In this case, the specified icon will be placed inside the notification icon directly.

Expanded Context Menus

To assign a menu to the notification icon, use the NotifyIconService's NotifyIconService.ContextMenu property.

Expanded Example

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T391918.

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