diff --git a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
index 962a3227d4..28cb84dad0 100644
--- a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
+++ b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
@@ -20,12 +20,12 @@ namespace ControlCatalog.ViewModels
ShowManagedNotificationCommand = ReactiveCommand.Create(() =>
{
- NotificationManager.Show(SimpleNotification.Create("Welcome", "Avalonia now supports Notifications.", NotificationType.Information));
+ NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Welcome", "Avalonia now supports Notifications.", NotificationType.Information));
});
ShowNativeNotificationCommand = ReactiveCommand.Create(() =>
{
- NotificationManager.Show(SimpleNotification.Create("Error", "Native Notifications are not quite ready. Coming soon.", NotificationType.Error));
+ NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Error", "Native Notifications are not quite ready. Coming soon.", NotificationType.Error));
});
}
diff --git a/samples/ControlCatalog/ViewModels/NotificationViewModel.cs b/samples/ControlCatalog/ViewModels/NotificationViewModel.cs
index 2fba6865c9..8724ba344b 100644
--- a/samples/ControlCatalog/ViewModels/NotificationViewModel.cs
+++ b/samples/ControlCatalog/ViewModels/NotificationViewModel.cs
@@ -10,12 +10,12 @@ namespace ControlCatalog.ViewModels
{
YesCommand = ReactiveCommand.Create(() =>
{
- manager.Show(SimpleNotification.Create("Avalonia Notifications", "Start adding notifications to your app today."));
+ manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today."));
});
NoCommand = ReactiveCommand.Create(() =>
{
- manager.Show(SimpleNotification.Create("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit..."));
+ manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit..."));
});
}
diff --git a/samples/ControlCatalog/Views/NotificationView.xaml b/samples/ControlCatalog/Views/NotificationView.xaml
index 5552aeb370..4f8f82b37f 100644
--- a/samples/ControlCatalog/Views/NotificationView.xaml
+++ b/samples/ControlCatalog/Views/NotificationView.xaml
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/src/Avalonia.Controls/Notifications/Notification.cs b/src/Avalonia.Controls/Notifications/Notification.cs
index 54a8e81f86..4aea4e5f9d 100644
--- a/src/Avalonia.Controls/Notifications/Notification.cs
+++ b/src/Avalonia.Controls/Notifications/Notification.cs
@@ -1,176 +1,40 @@
using System;
-using System.Linq;
-using System.Reactive.Linq;
-using Avalonia.Controls.Primitives;
-using Avalonia.Interactivity;
-using Avalonia.LogicalTree;
namespace Avalonia.Controls.Notifications
{
- public class Notification : ContentControl
+ ///
+ /// Defines content for a control.
+ ///
+ ///
+ /// This notification content type is compatible with native notifications.
+ ///
+ public class Notification : INotification
{
- private bool _isClosed;
- private bool _isClosing;
-
- static Notification()
- {
- IsClosedProperty.Changed.AddClassHandler(IsClosedChanged);
- }
-
- public Notification()
- {
- this.GetObservable(ContentProperty)
- .OfType()
- .Subscribe(x =>
- {
- switch (x.Type)
- {
- case NotificationType.Error:
- PseudoClasses.Add(":error");
- break;
-
- case NotificationType.Information:
- PseudoClasses.Add(":information");
- break;
-
- case NotificationType.Success:
- PseudoClasses.Add(":success");
- break;
-
- case NotificationType.Warning:
- PseudoClasses.Add(":warning");
- break;
- }
- });
- }
-
- ///
- /// Determines if the notification is already closing.
- ///
- public bool IsClosing
- {
- get { return _isClosing; }
- private set { SetAndRaise(IsClosingProperty, ref _isClosing, value); }
- }
-
- public static readonly DirectProperty IsClosingProperty =
- AvaloniaProperty.RegisterDirect(nameof(IsClosing), o => o.IsClosing);
-
- ///
- /// Determines if the notification is closed.
- ///
- public bool IsClosed
- {
- get { return _isClosed; }
- set { SetAndRaise(IsClosedProperty, ref _isClosed, value); }
- }
-
- ///
- /// Defines the property.
- ///
- public static readonly DirectProperty IsClosedProperty =
- AvaloniaProperty.RegisterDirect(nameof(IsClosed), o => o.IsClosed, (o, v) => o.IsClosed = v);
-
- ///
- /// Defines the event.
- ///
- public static readonly RoutedEvent NotificationCloseInvokedEvent =
- RoutedEvent.Register(nameof(NotificationCloseInvoked), RoutingStrategies.Bubble);
-
- ///
- /// Defines the event.
- ///
- public static readonly RoutedEvent NotificationClosedEvent =
- RoutedEvent.Register(nameof(NotificationClosed), RoutingStrategies.Bubble);
-
- ///
- /// Raised when notification close event is invoked.
- ///
- public event EventHandler NotificationCloseInvoked
- {
- add { AddHandler(NotificationCloseInvokedEvent, value); }
- remove { RemoveHandler(NotificationCloseInvokedEvent, value); }
- }
-
- public event EventHandler NotificationClosed
- {
- add { AddHandler(NotificationClosedEvent, value); }
- remove { RemoveHandler(NotificationClosedEvent, value); }
- }
-
- public static bool GetCloseOnClick(Notification obj)
- {
- return (bool)obj.GetValue(CloseOnClickProperty);
- }
-
- public static void SetCloseOnClick(Notification obj, bool value)
- {
- obj.SetValue(CloseOnClickProperty, value);
- }
-
- public static readonly AvaloniaProperty CloseOnClickProperty =
- AvaloniaProperty.RegisterAttached