Table of Contents

Class TrayIcon

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll
public class TrayIcon : AvaloniaObject, INotifyPropertyChanged, INativeMenuExporterProvider, IDisposable
Inheritance
TrayIcon
Implements
Inherited Members

Constructors

TrayIcon()

public TrayIcon()

Fields

CommandParameterProperty

Defines the CommandParameter property.

public static readonly StyledProperty<object?> CommandParameterProperty

Field Value

StyledProperty<object>

CommandProperty

Defines the Command property.

public static readonly StyledProperty<ICommand?> CommandProperty

Field Value

StyledProperty<ICommand>

IconProperty

Defines the Icon property.

public static readonly StyledProperty<WindowIcon?> IconProperty

Field Value

StyledProperty<WindowIcon>

IconsProperty

Defines the TrayIcons attached property.

public static readonly AttachedProperty<TrayIcons?> IconsProperty

Field Value

AttachedProperty<TrayIcons>

IsVisibleProperty

Defines the IsVisible property.

public static readonly StyledProperty<bool> IsVisibleProperty

Field Value

StyledProperty<bool>

MenuProperty

Defines the Menu property.

public static readonly StyledProperty<NativeMenu?> MenuProperty

Field Value

StyledProperty<NativeMenu>

ToolTipTextProperty

Defines the ToolTipText property.

public static readonly StyledProperty<string?> ToolTipTextProperty

Field Value

StyledProperty<string>

Properties

Command

Gets or sets the Command property of a TrayIcon.

public ICommand? Command { get; set; }

Property Value

ICommand

CommandParameter

Gets or sets the parameter to pass to the Command property of a TrayIcon.

public object? CommandParameter { get; set; }

Property Value

object

Icon

Gets or sets the icon of the TrayIcon.

public WindowIcon? Icon { get; set; }

Property Value

WindowIcon

IsVisible

Gets or sets the visibility of the TrayIcon.

public bool IsVisible { get; set; }

Property Value

bool

Menu

Gets or sets the Menu of the TrayIcon.

public NativeMenu? Menu { get; set; }

Property Value

NativeMenu

NativeMenuExporter

public INativeMenuExporter? NativeMenuExporter { get; }

Property Value

INativeMenuExporter

ToolTipText

Gets or sets the tooltip text of the TrayIcon.

public string? ToolTipText { get; set; }

Property Value

string

Methods

Dispose()

Disposes the tray icon (removing it from the tray area).

public void Dispose()

GetIcons(Application)

public static TrayIcons? GetIcons(Application o)

Parameters

o Application

Returns

TrayIcons

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)

Parameters

change AvaloniaPropertyChangedEventArgs

The property change details.

SetIcons(Application, TrayIcons?)

public static void SetIcons(Application o, TrayIcons? trayIcons)

Parameters

o Application
trayIcons TrayIcons

Events

Clicked

Raised when the TrayIcon is clicked. Note, this is only supported on Win32 and some Linux DEs, on OSX this event is not raised.

public event EventHandler? Clicked

Event Type

EventHandler