Skip to content

emako/NativeTray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuGet Actions Platform

NativeTray

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.

Features

  • 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.

Usage

Install NativeTray via NuGet:

dotnet add package NativeTray

Example 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 TrayRelayCommand(_ => { /* action */ }) },
    new TraySeparator(),
    new TrayMenuItem { Header = "Exit", Command = new TrayRelayCommand(_ => 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 TrayRelayCommand.

You can set the tray icon theme mode:

trayIcon.ThemeMode = TrayThemeMode.Dark;

Demo

License

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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Contributors