From 5946de28e6c236985d009d868b992bb2004722fd Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 2 Dec 2022 09:57:33 +0100 Subject: [PATCH] Notifications: Correctly set parent As of Avalonia 11 the notifications are broken and are shown always in the upper left corner. I'm not an expert, but as the parent of the control is not correctly set, we can imagine that the library assumes that the coordinate (0, 0) is going to be used and thus it appears always at a static location. After fixing the assignment of the parent, the notification bubbles are shown at the right corner again. Signed-off-by: Thomas Karl Pietrowski Signed-off-by: Thomas Karl Pietrowski Signed-off-by: Malte Lauterjung --- .../Notifications/WindowNotificationManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs index 45beaa0b2f..46c772f3b1 100644 --- a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs +++ b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs @@ -146,7 +146,11 @@ namespace Avalonia.Controls.Notifications { var adornerLayer = host.FindDescendantOfType()?.AdornerLayer; - adornerLayer?.Children.Add(this); + if (adornerLayer is not null) + { + adornerLayer.Children.Add(this); + AdornerLayer.SetAdornedElement(this, adornerLayer); + } } private void UpdatePseudoClasses(NotificationPosition position)