From db7cbaa61d3d86f8f01a04fd82fbf68bb61afd44 Mon Sep 17 00:00:00 2001 From: Dong Bin <14807942+rabbitism@users.noreply.github.com> Date: Mon, 25 Sep 2023 06:47:19 +0800 Subject: [PATCH] feat: WindowNotificationManager: support TopCenter and BottomCenter position (#12804) * feat: support topcenter and bottom center. * fix: fix typo. --- .../Notifications/NotificationPosition.cs | 4 +++- .../Notifications/WindowNotificationManager.cs | 4 +++- .../Controls/WindowNotificationManager.xaml | 11 +++++++++++ .../Controls/WindowNotificationManager.xaml | 11 +++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Notifications/NotificationPosition.cs b/src/Avalonia.Controls/Notifications/NotificationPosition.cs index 79f22f7972..f853ed6fe6 100644 --- a/src/Avalonia.Controls/Notifications/NotificationPosition.cs +++ b/src/Avalonia.Controls/Notifications/NotificationPosition.cs @@ -9,6 +9,8 @@ TopLeft, TopRight, BottomLeft, - BottomRight + BottomRight, + TopCenter, + BottomCenter, } } diff --git a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs index 6d9a030ead..20ebd94a76 100644 --- a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs +++ b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs @@ -15,7 +15,7 @@ namespace Avalonia.Controls.Notifications /// An that displays notifications in a . /// [TemplatePart("PART_Items", typeof(Panel))] - [PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright")] + [PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright", ":topcenter", ":bottomcenter")] public class WindowNotificationManager : TemplatedControl, IManagedNotificationManager { private IList? _items; @@ -215,6 +215,8 @@ namespace Avalonia.Controls.Notifications PseudoClasses.Set(":topright", position == NotificationPosition.TopRight); PseudoClasses.Set(":bottomleft", position == NotificationPosition.BottomLeft); PseudoClasses.Set(":bottomright", position == NotificationPosition.BottomRight); + PseudoClasses.Set(":topcenter", position == NotificationPosition.TopCenter); + PseudoClasses.Set(":bottomcenter", position == NotificationPosition.BottomCenter); } } } diff --git a/src/Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml b/src/Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml index a62f4adfd6..cbdd01bd6f 100644 --- a/src/Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml @@ -42,6 +42,11 @@ + + + + diff --git a/src/Avalonia.Themes.Simple/Controls/WindowNotificationManager.xaml b/src/Avalonia.Themes.Simple/Controls/WindowNotificationManager.xaml index ede24fd6eb..e13848b9fa 100644 --- a/src/Avalonia.Themes.Simple/Controls/WindowNotificationManager.xaml +++ b/src/Avalonia.Themes.Simple/Controls/WindowNotificationManager.xaml @@ -38,6 +38,11 @@ + + + +