Sfoglia il codice sorgente

Reset `InheritanceParent` in ContentControlMixin.

Doing it where we were doing it before caused #2823.
Steven Kirk 6 anni fa
parent
commit
1dec99ab69

+ 1 - 0
src/Avalonia.Controls/Mixins/ContentControlMixin.cs

@@ -150,6 +150,7 @@ namespace Avalonia.Controls.Mixins
                 if (oldValue is IControl child)
                 if (oldValue is IControl child)
                 {
                 {
                     logicalChildren.Remove(child);
                     logicalChildren.Remove(child);
+                    ((ISetInheritanceParent)child).SetParent(child.Parent);
                 }
                 }
 
 
                 child = newValue as IControl;
                 child = newValue as IControl;

+ 0 - 1
src/Avalonia.Controls/Presenters/ContentPresenter.cs

@@ -229,7 +229,6 @@ namespace Avalonia.Controls.Presenters
                 if (oldChild != null)
                 if (oldChild != null)
                 {
                 {
                     VisualChildren.Remove(oldChild);
                     VisualChildren.Remove(oldChild);
-                    ((ISetInheritanceParent)oldChild).SetParent(oldChild.Parent);
                 }
                 }
 
 
                 if (oldChild?.Parent == this)
                 if (oldChild?.Parent == this)