|
|
@@ -68,6 +68,12 @@ namespace Avalonia.Controls
|
|
|
public static readonly AttachedProperty<TrayIcons> IconsProperty
|
|
|
= AvaloniaProperty.RegisterAttached<TrayIcon, Application, TrayIcons>("Icons");
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Defines the <see cref="Menu"/> property.
|
|
|
+ /// </summary>
|
|
|
+ public static readonly StyledProperty<NativeMenu?> MenuProperty
|
|
|
+ = AvaloniaProperty.Register<TrayIcon, NativeMenu?>(nameof(Menu));
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Defines the <see cref="Icon"/> property.
|
|
|
/// </summary>
|
|
|
@@ -90,6 +96,15 @@ namespace Avalonia.Controls
|
|
|
|
|
|
public static TrayIcons GetIcons(AvaloniaObject o) => o.GetValue(IconsProperty);
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets the Menu of the TrayIcon.
|
|
|
+ /// </summary>
|
|
|
+ public NativeMenu? Menu
|
|
|
+ {
|
|
|
+ get => GetValue(MenuProperty);
|
|
|
+ set => SetValue(MenuProperty, value);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Gets or sets the icon of the TrayIcon.
|
|
|
/// </summary>
|
|
|
@@ -155,6 +170,10 @@ namespace Avalonia.Controls
|
|
|
{
|
|
|
_impl.SetToolTipText(change.NewValue.GetValueOrDefault<string?>());
|
|
|
}
|
|
|
+ else if (change.Property == MenuProperty)
|
|
|
+ {
|
|
|
+ _impl.MenuExporter?.SetNativeMenu(change.NewValue.GetValueOrDefault<NativeMenu>());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|