From 333c23ca157703b2692ea7a1a08d6c781112a213 Mon Sep 17 00:00:00 2001 From: Seoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com> Date: Thu, 23 Aug 2018 15:11:48 +0900 Subject: [PATCH] [NUI] Fix only to give children a layout in an explicit layout (#408) Signed-off-by: Seoyeon Kim --- src/Tizen.NUI/src/public/BaseComponents/View.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index be55ce4..3c6b82e 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -1221,6 +1221,8 @@ namespace Tizen.NUI.BaseComponents private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private bool layoutSet = false; // Flag to indicate if SetLayout was called or View was automatically given a Layout + internal View(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.View_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); @@ -1281,7 +1283,7 @@ namespace Tizen.NUI.BaseComponents oldParent.Remove(child); } - if (child.Layout == null) + if (layoutSet == true && child.Layout == null) // Only give children a layout if parent an explicit container { LayoutItem layoutItem = new LayoutItem(); child.Layout = layoutItem; @@ -3443,6 +3445,7 @@ namespace Tizen.NUI.BaseComponents { Tizen.NUI.NDalicManualPINVOKE.SetLayout__SWIG_1(View.getCPtr(this), LayoutItem.getCPtr(value)); value.LayoutChildren.Clear(); + layoutSet = true; foreach (View view in Children) { value.LayoutChildren.Add(view.Layout); -- 2.7.4