diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml
index ec3734f4f5..7a5dc0d9ec 100644
--- a/samples/ControlCatalog/App.xaml
+++ b/samples/ControlCatalog/App.xaml
@@ -1,38 +1,19 @@
+
-
+
-
-
-
-
-
-
-
-
-
diff --git a/samples/ControlCatalog/App.xaml.cs b/samples/ControlCatalog/App.xaml.cs
index 5f7dc248c0..36b6fc2dcd 100644
--- a/samples/ControlCatalog/App.xaml.cs
+++ b/samples/ControlCatalog/App.xaml.cs
@@ -5,11 +5,17 @@ using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml.Styling;
using Avalonia.Styling;
+using ControlCatalog.ViewModels;
namespace ControlCatalog
{
public class App : Application
{
+ public App()
+ {
+ DataContext = new ApplicationViewModel();
+ }
+
private static readonly StyleInclude DataGridFluent = new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
{
Source = new Uri("avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml")
diff --git a/samples/ControlCatalog/ViewModels/ApplicationViewModel.cs b/samples/ControlCatalog/ViewModels/ApplicationViewModel.cs
new file mode 100644
index 0000000000..c96872ef7f
--- /dev/null
+++ b/samples/ControlCatalog/ViewModels/ApplicationViewModel.cs
@@ -0,0 +1,22 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using MiniMvvm;
+
+namespace ControlCatalog.ViewModels
+{
+ public class ApplicationViewModel : ViewModelBase
+ {
+ public ApplicationViewModel()
+ {
+ ExitCommand = MiniCommand.Create(() =>
+ {
+ if(Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime)
+ {
+ lifetime.Shutdown();
+ }
+ });
+ }
+
+ public MiniCommand ExitCommand { get; }
+ }
+}
diff --git a/src/Avalonia.Controls/TrayIcon.cs b/src/Avalonia.Controls/TrayIcon.cs
index dfa71dcb1e..bdfea40b5e 100644
--- a/src/Avalonia.Controls/TrayIcon.cs
+++ b/src/Avalonia.Controls/TrayIcon.cs
@@ -13,7 +13,7 @@ namespace Avalonia.Controls
{
}
- public class TrayIcon : AvaloniaObject, IDataContextProvider, INativeMenuExporterProvider, IDisposable
+ public class TrayIcon : AvaloniaObject, INativeMenuExporterProvider, IDisposable
{
private readonly ITrayIconImpl _impl;
@@ -79,12 +79,6 @@ namespace Avalonia.Controls
public static readonly AttachedProperty TrayIconsProperty
= AvaloniaProperty.RegisterAttached("TrayIcons");
- ///
- /// Defines the property.
- ///
- public static readonly StyledProperty