From d6567bb32c06e2fd78611783c9a5067281804e0f Mon Sep 17 00:00:00 2001 From: neostom432 <31119276+neostom432@users.noreply.github.com> Date: Wed, 5 Feb 2020 10:55:08 +0900 Subject: [PATCH] [NUI] Measure whole child in GridLayout (#1364) Currently, GridLayout measures only first child for calculation so other child cannot layout its children. Now, GridLayout measures whole child so they can layout its children. Co-authored-by: agnelovaz --- src/Tizen.NUI/src/public/Layouting/GridLayout.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs index fe1729d..d886faf 100755 --- a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs @@ -122,20 +122,24 @@ namespace Tizen.NUI var childCount = LayoutChildren.Count; // WIDTH SPECIFICATIONS - - // measure first child and use it's dimensions for layout measurement - if (childCount > 0) { - LayoutItem childLayoutItem = LayoutChildren[0]; - View childOwner = childLayoutItem.Owner; + foreach( LayoutItem childLayout in LayoutChildren ) + { + if( childLayout != null ) + { + MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec ); + } + } + + // Use first child's dimensions for layout measurement + View childOwner = LayoutChildren[0].Owner; - MeasureChild( childLayoutItem, widthMeasureSpec, heightMeasureSpec ); - desiredChildHeight = (int)childLayoutItem.MeasuredHeight.Size.AsRoundedValue(); - desiredChildWidth = (int)childLayoutItem.MeasuredWidth.Size.AsRoundedValue(); + desiredChildHeight = (int)LayoutChildren[0].MeasuredHeight.Size.AsRoundedValue(); + desiredChildWidth = (int)LayoutChildren[0].MeasuredWidth.Size.AsRoundedValue(); // If child has a margin then add it to desired size - Extents childMargin = childLayoutItem.Margin; + Extents childMargin = LayoutChildren[0].Margin; desiredChildHeight += childMargin.Top + childMargin.Bottom; desiredChildWidth += childMargin.Start + childMargin.End; -- 2.7.4