Takoooooo 4 years ago
parent
commit
01518b37e7

+ 2 - 4
src/Avalonia.Styling/LogicalTree/ControlLocator.cs

@@ -57,10 +57,8 @@ namespace Avalonia.LogicalTree
             private void Detached(object sender, LogicalTreeAttachmentEventArgs e)
             {
                 _value = null;
-                if (_relativeTo.IsAttachedToLogicalTree)
-                {
-                    PublishNext(null);
-                }
+                PublishNext(null);
+
             }
 
             private void Update()

+ 1 - 1
src/Avalonia.Visuals/Visual.cs

@@ -493,7 +493,7 @@ namespace Avalonia
             // In theory this should only need to check for logical tree attachment, but in practise
             // due to ContentControlMixin only taking effect when the template has finished being
             // applied, some controls are attached to the visual tree before the logical tree.
-            if (((ILogical)this).IsAttachedToLogicalTree || ((IVisual)this).IsAttachedToVisualTree)
+            if (((ILogical)this).IsAttachedToLogicalTree)
             {
                 if (e is BindingChainException b &&
                     string.IsNullOrEmpty(b.ExpressionErrorPoint) &&