summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-27 15:48:31 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-27 15:48:31 -0700
commit904d06d81269d9b03e148ab1467aeb163c8b736d (patch)
tree54828569ce77c330a4fdbb8b1467f42a67509f88 /Xamarin.Forms.Core
parent1ee2a1d31138e6da2b048b37a01893146348b6f9 (diff)
downloadxamarin-forms-904d06d81269d9b03e148ab1467aeb163c8b736d.tar.gz
xamarin-forms-904d06d81269d9b03e148ab1467aeb163c8b736d.tar.bz2
xamarin-forms-904d06d81269d9b03e148ab1467aeb163c8b736d.zip
[C]Remove view from previous parent when added to new parent layout
Technically this could be considered a breaking change if someone was depending on the old behavior, however the old behavior resulted in layouts that were not predictable to the user. So while yes someone could have built something that works, it would have been via trial and error and generally breaking the rule of one parent to each view. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=39509
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/Layout.cs3
1 files changed, 3 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/Layout.cs b/Xamarin.Forms.Core/Layout.cs
index c611777c..a7864070 100644
--- a/Xamarin.Forms.Core/Layout.cs
+++ b/Xamarin.Forms.Core/Layout.cs
@@ -395,6 +395,9 @@ namespace Xamarin.Forms
void OnInternalAdded(View view)
{
+ var parent = view.Parent as Layout;
+ parent?.InternalChildren.Remove(view);
+
OnChildAdded(view);
if (ShouldInvalidateOnChildAdded(view))
InvalidateLayout();