From: Jaehyun Cho Date: Mon, 29 Aug 2022 04:16:41 +0000 (+0900) Subject: [NUI] Fix ContentPageLayout to measure AppBar prior to Content X-Git-Tag: accepted/tizen/unified/20231205.024657~747 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=cda3df444488cb65d6560a73a3484940a6a2e909;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [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. --- 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); }