diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml
index d0e1bd885e4..fab46223035 100644
--- a/samples/ControlCatalog/App.xaml
+++ b/samples/ControlCatalog/App.xaml
@@ -43,6 +43,7 @@
+
diff --git a/src/Avalonia.Controls/TrayIcon.cs b/src/Avalonia.Controls/TrayIcon.cs
index ad4f2006157..3c63a29ad69 100644
--- a/src/Avalonia.Controls/TrayIcon.cs
+++ b/src/Avalonia.Controls/TrayIcon.cs
@@ -63,6 +63,10 @@ static TrayIcon()
args.NewValue.Value.CollectionChanged += Icons_CollectionChanged;
}
}
+ else
+ {
+ throw new InvalidOperationException("TrayIcon.Icons must be set on the Application.");
+ }
});
var app = Application.Current ?? throw new InvalidOperationException("Application not yet initialized.");
@@ -125,9 +129,9 @@ public static readonly StyledProperty MenuProperty
public static readonly StyledProperty IsVisibleProperty =
Visual.IsVisibleProperty.AddOwner();
- public static void SetIcons(AvaloniaObject o, TrayIcons trayIcons) => o.SetValue(IconsProperty, trayIcons);
+ public static void SetIcons(Application o, TrayIcons trayIcons) => o.SetValue(IconsProperty, trayIcons);
- public static TrayIcons GetIcons(AvaloniaObject o) => o.GetValue(IconsProperty);
+ public static TrayIcons GetIcons(Application o) => o.GetValue(IconsProperty);
///
/// Gets or sets the property of a TrayIcon.
diff --git a/src/Avalonia.Themes.Default/NativeMenuBar.xaml b/src/Avalonia.Themes.Default/NativeMenuBar.xaml
index c5d7ad55d70..9d004e3f7e1 100644
--- a/src/Avalonia.Themes.Default/NativeMenuBar.xaml
+++ b/src/Avalonia.Themes.Default/NativeMenuBar.xaml
@@ -13,6 +13,7 @@