diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml
index ce79a4bddd..b6b4e0c242 100644
--- a/samples/ControlCatalog/MainView.xaml
+++ b/samples/ControlCatalog/MainView.xaml
@@ -29,7 +29,7 @@
-
+
diff --git a/samples/ControlCatalog/Pages/NotificationsPage.xaml b/samples/ControlCatalog/Pages/NotificationsPage.xaml
index 3f68878337..94e2314dc7 100644
--- a/samples/ControlCatalog/Pages/NotificationsPage.xaml
+++ b/samples/ControlCatalog/Pages/NotificationsPage.xaml
@@ -1,9 +1,10 @@
-
-
-
-
+
+ Notifications
+
+
+
diff --git a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
index 95995b9f26..4623149a88 100644
--- a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
+++ b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
@@ -1,7 +1,9 @@
+using System.Reactive;
using System.Threading.Tasks;
using Avalonia.Controls.Notifications;
using Avalonia.Diagnostics.ViewModels;
using Avalonia.Threading;
+using ReactiveUI;
namespace ControlCatalog.ViewModels
{
@@ -9,27 +11,19 @@ namespace ControlCatalog.ViewModels
{
public MainWindowViewModel()
{
- Dispatcher.UIThread.InvokeAsync(async () =>
+ ShowCustomManagedNotificationCommand = ReactiveCommand.Create(() =>
{
- await Task.Delay(5000);
-
- NotificationManager.Show(new NotificationViewModel (NotificationManager) { Title = "Warning", Message = "Did you know that Avalonia now supports Notifications?" });
-
- await Task.Delay(1500);
- NotificationManager.Show(new NotificationContent { Title= "Title", Message = "Test2", Type = NotificationType.Error });
-
- await Task.Delay(2000);
- NotificationManager.Show(new NotificationContent { Title = "Title", Message = "Test3", Type = NotificationType.Warning });
-
- await Task.Delay(2500);
- NotificationManager.Show(new NotificationContent { Title = "Title", Message = "Test4", Type = NotificationType.Success });
-
- await Task.Delay(2500);
- NotificationManager.Show(new NotificationContent { Title = "Title", Message = "Test5", Type = NotificationType.Information });
+ NotificationManager.Show(new NotificationViewModel(NotificationManager) { Title = "Hey There!", Message = "Did you know that Avalonia now supports Custom In-Window Notifications?" });
+ });
- await Task.Delay(500);
- NotificationManager.Show("Test5");
+ ShowManagedNotificationCommand = ReactiveCommand.Create(() =>
+ {
+ NotificationManager.Show(new NotificationContent { Title = "Welcome", Message = "Avalonia now supports Notifications.", Type = NotificationType.Information });
+ });
+ ShowNativeNotificationCommand = ReactiveCommand.Create(() =>
+ {
+ NotificationManager.Show(new NotificationContent { Title = "Error", Message = "Native Notifications are not quite ready. Coming soon.", Type = NotificationType.Error });
});
}
@@ -40,5 +34,11 @@ namespace ControlCatalog.ViewModels
get { return _notificationManager; }
set { this.RaiseAndSetIfChanged(ref _notificationManager, value); }
}
+
+ public ReactiveCommand ShowCustomManagedNotificationCommand { get; }
+
+ public ReactiveCommand ShowManagedNotificationCommand { get; }
+
+ public ReactiveCommand ShowNativeNotificationCommand { get; }
}
}
diff --git a/samples/ControlCatalog/Views/NotificationView.xaml b/samples/ControlCatalog/Views/NotificationView.xaml
index a7576f11c3..5552aeb370 100644
--- a/samples/ControlCatalog/Views/NotificationView.xaml
+++ b/samples/ControlCatalog/Views/NotificationView.xaml
@@ -1,7 +1,7 @@
-
+