Browse Source

AdornerDecorator passes on OnAttachedToLogicalTree to the AdornerLayer

Dan Walmsley 6 years ago
parent
commit
351f5d10f0
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/Avalonia.Controls/Primitives/AdornerDecorator.cs

+ 9 - 0
src/Avalonia.Controls/Primitives/AdornerDecorator.cs

@@ -1,6 +1,8 @@
 // Copyright (c) The Avalonia Project. All rights reserved.
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
+using Avalonia.LogicalTree;
+
 namespace Avalonia.Controls.Primitives
 {
     public class AdornerDecorator : Decorator
@@ -13,6 +15,13 @@ namespace Avalonia.Controls.Primitives
             VisualChildren.Add(AdornerLayer);
         }
 
+        protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
+        {
+            base.OnAttachedToLogicalTree(e);
+
+            ((ILogical)AdornerLayer).NotifyAttachedToLogicalTree(e);
+        }
+
         public AdornerLayer AdornerLayer
         {
             get;