From cda3df444488cb65d6560a73a3484940a6a2e909 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Mon, 29 Aug 2022 13:16:41 +0900 Subject: [PATCH] [NUI] Fix ContentPageLayout to measure AppBar prior to Content Content's height is calculated correctly after AppBar's height is calculated. Therefore, AppBar is measured and then Content is measured. --- src/Tizen.NUI.Components/Controls/Navigation/ContentPage.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/Navigation/ContentPage.cs b/src/Tizen.NUI.Components/Controls/Navigation/ContentPage.cs index 9dd60ec..b92f9d3 100755 --- a/src/Tizen.NUI.Components/Controls/Navigation/ContentPage.cs +++ b/src/Tizen.NUI.Components/Controls/Navigation/ContentPage.cs @@ -211,6 +211,14 @@ namespace Tizen.NUI.Components var appBar = (Owner as ContentPage)?.AppBar; var content = (Owner as ContentPage)?.Content; + bool measureAppBarLayout = false; + + if ((appBar != null) && (appBar.Layout != null) && (LayoutChildren.Contains(appBar.Layout)) && appBar.Layout.SetPositionByLayout) + { + MeasureChildWithoutPadding(appBar.Layout, widthMeasureSpec, heightMeasureSpec); + measureAppBarLayout = true; + } + foreach (var childLayout in LayoutChildren) { if (!childLayout.SetPositionByLayout) @@ -218,13 +226,13 @@ namespace Tizen.NUI.Components continue; } - if ((content != null) && (content == childLayout.Owner) && (content.HeightSpecification == LayoutParamPolicies.MatchParent)) + if ((content != null) && (content == childLayout.Owner) && (content.HeightSpecification == LayoutParamPolicies.MatchParent) && measureAppBarLayout) { var contentSizeH = heightMeasureSpec.Size.AsDecimal() - Padding.Top - Padding.Bottom - content.Margin.Top - content.Margin.Bottom - (appBar?.Layout.MeasuredHeight.Size.AsDecimal() ?? 0); MeasureSpecification contentHeightSpec = new MeasureSpecification(new LayoutLength(contentSizeH), MeasureSpecification.ModeType.Exactly); MeasureChildWithoutPadding(childLayout, widthMeasureSpec, contentHeightSpec); } - else + else if (!measureAppBarLayout || (appBar != childLayout.Owner)) // if childLayout is not appBar.Layout { MeasureChildWithoutPadding(childLayout, widthMeasureSpec, heightMeasureSpec); } -- 2.7.4