Doing it where we were doing it before caused #2823.
@@ -150,6 +150,7 @@ namespace Avalonia.Controls.Mixins
if (oldValue is IControl child)
{
logicalChildren.Remove(child);
+ ((ISetInheritanceParent)child).SetParent(child.Parent);
}
child = newValue as IControl;
@@ -229,7 +229,6 @@ namespace Avalonia.Controls.Presenters
if (oldChild != null)
VisualChildren.Remove(oldChild);
- ((ISetInheritanceParent)oldChild).SetParent(oldChild.Parent);
if (oldChild?.Parent == this)