Skip to main content
Version: 11.0.x



The TrayIcon allows an Avalonia UI application to display an icon and a native menu in the system tray. It is supported on Windows, macOS and some Linux distributions (it is confirmed to work on Ubuntu).

You must define a tray menu in the application XAML file.

Useful Properties

You will probably use these properties most often:

IconThe icon to display in the system tray. Typically loaded from the application assets.
ToolTipTextTool tip text displayed when the user hovers over the tray icon.
TrayIcon.MenuThe native menu control attached to the tray icon.

You must use a native menu with the tray icon, and not the Avalonia UI menu control. For full details about the native menu, see the reference here.


This example defines a simple tray icon menu in the App.xaml file :

<Application xmlns=""
<TrayIcon Icon="/Assets/avalonia-logo.ico"
ToolTipText="Avalonia Tray Icon ToolTip">
<NativeMenuItem Header="Settings">
<NativeMenuItem Header="Option 1" />
<NativeMenuItem Header="Option 2" />
<NativeMenuItemSeparator />
<NativeMenuItem Header="Option 3" />

Include the .ico file in the .csproj file using an AvaloniaResource item:

<Project Sdk="Microsoft.NET.Sdk">
<AvaloniaResource Include="Assets/avalonia-logo.ico" />

More Information


For the complete API documentation about this control, see here.


View the source code on GitHub TrayIcon.cs