protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { foreach (var childLayout in LayoutChildren) { if (!childLayout.SetPositionByLayout) { continue; } LayoutLength childWidth = childLayout.MeasuredWidth.Size; LayoutLength childHeight = childLayout.MeasuredHeight.Size; LayoutLength childLeft = new LayoutLength(childLayout.Owner.PositionX); LayoutLength childTop = new LayoutLength(childLayout.Owner.PositionY); var appBar = (Owner as ContentPage)?.AppBar; var content = (Owner as ContentPage)?.Content; if ((content != null) && (content == childLayout.Owner)) { childTop = new LayoutLength(Padding.Top + content.Margin.Top + (appBar?.Layout.MeasuredHeight.Size.AsDecimal() ?? 0)); childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight, false); } else { childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight, true); } } }
/// <summary> /// Assign a size and position to each of its children.<br /> /// </summary> /// <param name="changed">This is a new size or position for this layout.</param> /// <param name="left">Left position, relative to parent.</param> /// <param name="top"> Top position, relative to parent.</param> /// <param name="right">Right position, relative to parent.</param> /// <param name="bottom">Bottom position, relative to parent.</param> /// <since_tizen> 6 </since_tizen> protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { // Absolute layout positions it's children at their Actor positions. // Children could overlap or spill outside the parent, as is the nature of absolute positions. foreach (LayoutItem childLayout in IterateLayoutChildren()) { LayoutLength childWidth = childLayout.MeasuredWidth.Size; LayoutLength childHeight = childLayout.MeasuredHeight.Size; LayoutLength childLeft = new LayoutLength(childLayout.Owner.PositionX); LayoutLength childTop = new LayoutLength(childLayout.Owner.PositionY); childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight, true); } }