NativeTray is a modern, easy-to-use library for displaying tray icons (NotifyIcon) in .NET applications. It supports WPF, WinForms, and other .NET platforms, providing non-intrusive system notifications and quick access functionality in the Windows taskbar.
Supports dark mode, custom icons, checkable menu items, and submenus.
- Native Win32 tray icon integration.
- Context menu with checkable, disabled, and bold items.
- Balloon notifications with custom title, text, and icon.
- Theme mode support (light, dark, system).
- High DPI support for crisp icon rendering.
- Easy API for menu and icon management.
Install NativeTray via NuGet:
dotnet add package NativeTrayExample usage:
using System.NativeTray;
var trayIcon = new TrayIconHost
{
ToolTipText = "NativeTray Demo.",
Icon = ... // Load your icon handle here.
};
trayIcon.Menu = new TrayMenu
{
new TrayMenuItem { Header = "Item 1", Command = new TrayCommand(_ => { /* action */ }) },
new TraySeparator(),
new TrayMenuItem { Header = "Exit", Command = new TrayCommand(_ => Environment.Exit(0)) }
};
trayIcon.ShowBalloonTip(3000, "Hello", "This is a balloon tip.", TrayToolTipIcon.Info);Menu item commands use the ITrayCommand abstraction. For simple actions, use TrayCommand.
You can set the tray icon theme mode:
trayIcon.ThemeMode = TrayThemeMode.Dark;- NativeTray.Demo.WPF for WPF applications.
- NativeTray.Demo.WinForms for WinForms applications.
- NativeTray.Demo.Avalonia for Avalonia applications.
- NativeTray.Demo.WinUI for WinUI applications.
- NativeTray.Demo.Maui for MAUI applications.
- NativeTray.Demo.Wice for Wice applications.
- NativeTray.Demo.ConsoleApp for Console applications.
UWP is not supported.
NativeTray relies on Win32 tray APIs (such as Shell_NotifyIcon), while UWP runs in a sandboxed app model and does not provide the required system tray/NotifyIcon capabilities. In short, this limitation comes from UWP itself rather than NativeTray.
For UWP applications, migration to WinUI3 is recommended, and WinUI3 is supported by NativeTray.
NativeTray is released under the MIT license. You are free to use and modify it, as long as you comply with the terms of the license.