Net4x.Hardcodet.NotifyIcon.Wpf 2.3.0.26285

dotnet add package Net4x.Hardcodet.NotifyIcon.Wpf --version 2.3.0.26285
                    
NuGet\Install-Package Net4x.Hardcodet.NotifyIcon.Wpf -Version 2.3.0.26285
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Net4x.Hardcodet.NotifyIcon.Wpf" Version="2.3.0.26285" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Net4x.Hardcodet.NotifyIcon.Wpf" Version="2.3.0.26285" />
                    
Directory.Packages.props
<PackageReference Include="Net4x.Hardcodet.NotifyIcon.Wpf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Net4x.Hardcodet.NotifyIcon.Wpf --version 2.3.0.26285
                    
#r "nuget: Net4x.Hardcodet.NotifyIcon.Wpf, 2.3.0.26285"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Net4x.Hardcodet.NotifyIcon.Wpf@2.3.0.26285
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Net4x.Hardcodet.NotifyIcon.Wpf&version=2.3.0.26285
                    
Install as a Cake Addin
#tool nuget:?package=Net4x.Hardcodet.NotifyIcon.Wpf&version=2.3.0.26285
                    
Install as a Cake Tool

Net4x.Hardcodet.NotifyIcon.Wpf

WPF system tray (notify) icon control: rich tooltips, popups, WPF context menus, standard and custom balloons, click commands. Usable from XAML or code (also hostable from Windows Forms apps).

Fork of hardcodet/wpf-notifyicon, multi-targeted for .NET Framework and modern .NET.

Install

dotnet add package Net4x.Hardcodet.NotifyIcon.Wpf

Supported frameworks

Family TFMs
.NET Framework net45, net462, net472
.NET Core / .NET netcoreapp3.1, net6.0-windows, net8.0-windows, net10.0-windows
  • Assembly: Hardcodet.NotifyIcon.Wpf
  • Namespace: Hardcodet.Wpf.TaskbarNotification
  • XAML xmlns: http://www.hardcodet.net/taskbar

XAML

<Window xmlns:tb="http://www.hardcodet.net/taskbar" ...>
  <tb:TaskbarIcon x:Name="MyNotifyIcon"
                  IconSource="/Icons/App.ico"
                  ToolTipText="My application"
                  DoubleClickCommand="{Binding ShowWindowCommand}">
    <tb:TaskbarIcon.ContextMenu>
      <ContextMenu>
        <MenuItem Header="Show" Command="{Binding ShowWindowCommand}" />
        <MenuItem Header="Exit" Command="{Binding ExitCommand}" />
      </ContextMenu>
    </tb:TaskbarIcon.ContextMenu>
  </tb:TaskbarIcon>
</Window>

For a window-less app, declare the icon as a resource and fetch it in App.OnStartup with FindResource("...").

Code

using Hardcodet.Wpf.TaskbarNotification;

var icon = new TaskbarIcon
{
    Icon = new System.Drawing.Icon("App.ico"),
    ToolTipText = "My application"
};

icon.ShowBalloonTip("Title", "Hello from the tray", BalloonIcon.Info);

// when done
icon.Dispose();

Key properties

Property Type Default Purpose
IconSource ImageSource – Icon from a WPF resource/URI (XAML-friendly); sets Icon
Icon System.Drawing.Icon – Icon from code
ToolTipText string – Plain tooltip; fallback when TrayToolTip is not set/supported
TrayToolTip UIElement – Custom WPF tooltip
TrayPopup UIElement – Interactive popup shown on click
ContextMenu ContextMenu – WPF context menu
MenuActivation PopupActivationMode RightClick Click that opens ContextMenu
PopupActivation PopupActivationMode LeftClick Click that opens TrayPopup
PopupPlacement PlacementMode AbsolutePoint TrayPopup placement (see also PopupHorizontalOffset, PopupVerticalOffset, CustomPopupPosition)
LeftClickCommand ICommand – Run on left click (...CommandParameter, ...CommandTarget)
DoubleClickCommand ICommand – Run on double click (...CommandParameter, ...CommandTarget)
NoLeftClickDelay bool false Handle left click immediately instead of waiting for the double-click interval

PopupActivationMode: LeftClick, RightClick, DoubleClick, LeftOrRightClick, LeftOrDoubleClick, MiddleClick, All, None.

Read-only: IsTaskbarIconCreated, IsDisposed, TrayPopupResolved, TrayToolTipResolved, CustomBalloon.

Key methods

Method Purpose
ShowBalloonTip(title, message, BalloonIcon) Standard balloon; BalloonIcon: None, Info, Warning, Error
ShowBalloonTip(title, message, Icon customIcon, bool largeIcon = false) Standard balloon with custom icon
HideBalloonTip() Hide the standard balloon
ShowCustomBalloon(UIElement, PopupAnimation, int? timeout) Show a WPF element as balloon; timeout ms, null = stays open
CloseBalloon() Close the custom balloon
ResetBalloonCloseTimer() Restart the custom balloon timeout
ShowTrayPopup() / CloseTrayPopup() Open / close TrayPopup programmatically
GetPopupTrayPosition() Tray position used for popups
Dispose() Remove the icon from the tray

Key events

All are routed events (RoutedEventHandler).

Group Events
Mouse TrayLeftMouseDown, TrayLeftMouseUp, TrayRightMouseDown, TrayRightMouseUp, TrayMiddleMouseDown, TrayMiddleMouseUp, TrayMouseDoubleClick, TrayMouseMove
Balloon TrayBalloonTipShown, TrayBalloonTipClosed, TrayBalloonTipClicked
Popup / menu PreviewTrayPopupOpen, TrayPopupOpen, PreviewTrayContextMenuOpen, TrayContextMenuOpen
ToolTip PreviewTrayToolTipOpen, TrayToolTipOpen, PreviewTrayToolTipClose, TrayToolTipClose

Attached events raised on hosted elements (for animations/triggers): PopupOpened, ToolTipOpened, ToolTipClose, BalloonShowing, BalloonClosing. Attached property ParentTaskbarIcon gives hosted elements access to the icon.

Lifetime

  • TaskbarIcon is IDisposable: call Dispose() when no longer needed, otherwise the icon stays in the tray.
  • If Application.Current exists, the icon disposes itself on Application.Exit; call Dispose() explicitly anyway in window-less / Windows Forms hosts.
  • Icons declared in a Window should be disposed when the window closes if the app keeps running.

Credits and license

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • net10.0-windows7.0

    • No dependencies.
  • net6.0-windows7.0

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Net4x.Hardcodet.NotifyIcon.Wpf:

Package Downloads
Net4x.NotifyIconWpf

NotifyIcon Wpf Library

Net4x.WindowsWpfLibrary

Windows Library

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0.26285 128 10/15/2026
2.3.0 1,254 4/4/2025
2.1.0 6,811 8/27/2023