public void ReinflatesViewsCorrectly() { var child1 = new BoxView { IsPlatformEnabled = true, VerticalOptions = LayoutOptions.FillAndExpand, HeightRequest = 400, MinimumHeightRequest = 10 }; var child2 = new BoxView { IsPlatformEnabled = true, HeightRequest = 40, MinimumHeightRequest = 40 }; var stack = new StackLayout { Spacing = 0, IsPlatformEnabled = true, Children = { child1, child2 } }; stack.Layout(new Rectangle(0, 0, 100, 100)); Assert.AreEqual(new Rectangle(0, 0, 100, 60), child1.Bounds); Assert.AreEqual(new Rectangle(0, 60, 100, 40), child2.Bounds); stack.Measure(100, 100); stack.Layout(new Rectangle(0, 0, 100, 500)); Assert.AreEqual(new Rectangle(0, 0, 100, 460), child1.Bounds); Assert.AreEqual(new Rectangle(0, 460, 100, 40), child2.Bounds); }
async void AnimateToPageIndex(object index, bool animated = true) { var bounds = GetBoundsWithX(-_currentPageIndex * Width); _isAnimating = true; if (animated) { await _contentView.LayoutTo(bounds); } else { _contentView.Layout(bounds); } _isAnimating = false; }
protected override void LayoutChildren(double x, double y, double width, double height) { //如果要求显示对话框,而且对话框也已经显示了,不再做布局。 if (_dialogIsShowing && _dialogFrame?.IsVisible == true) { return; } Content.Layout(new Rectangle(x, y, width, height)); if (_toast.IsVisible) { var size = _toast.Measure(width, height).Request; _toast.Layout(new Rectangle((width - size.Width) / 2, 70, size.Width, size.Height)); } if (_dialogIsShowing) { Debug.Assert(_dialogFrame != null, "_dialogFrame != null"); _dialogFrame.IsVisible = true; _dialogFrame.Layout(new Rectangle(x, y, width, height)); } else { Debug.Assert(_dialogFrame != null, "_dialogFrame != null"); _dialogFrame.IsVisible = false; } }
public void TestExpandVertical() { View child1, child2, child3; var stack = new StackLayout { IsPlatformEnabled = true, Orientation = StackOrientation.Vertical, Children = { (child1 = new View { WidthRequest = 20, HeightRequest = 20, IsPlatformEnabled = true }), (child2 = new View { WidthRequest = 20, HeightRequest = 20, IsPlatformEnabled = true, VerticalOptions = LayoutOptions.FillAndExpand }), (child3 = new View { WidthRequest = 20, HeightRequest = 20, IsPlatformEnabled = true }) } }; stack.Padding = new Thickness(10, 5); stack.Layout(new Rectangle(0, 0, 100, 100)); Assert.AreEqual(new Rectangle(10, 5, 80, 20), child1.Bounds); Assert.AreEqual(new Rectangle(10, 31, 80, 100 - 2 * 31), child2.Bounds); Assert.AreEqual(new Rectangle(10, 75, 80, 20), child3.Bounds); }
public void HorizontalRequestInVerticalLayout() { var stack = new StackLayout { IsPlatformEnabled = true, Children = { new View { WidthRequest = 20, HeightRequest = 30, IsPlatformEnabled = true, HorizontalOptions = LayoutOptions.Start }, new View { WidthRequest = 20, HeightRequest = 30, IsPlatformEnabled = true, HorizontalOptions = LayoutOptions.Center }, new View { WidthRequest = 20, HeightRequest = 30, IsPlatformEnabled = true, HorizontalOptions = LayoutOptions.End } } }; stack.Layout(new Rectangle(0, 0, 200, 200)); Assert.AreEqual(new Rectangle(0, 0, 20, 30), stack.Children[0].Frame); Assert.AreEqual(new Rectangle(90, 36, 20, 30), stack.Children[1].Frame); Assert.AreEqual(new Rectangle(180, 72, 20, 30), stack.Children[2].Frame); }
public PanGestureExample3() { InitializeComponent(); MainLayout.OnLayoutChildren += MainLayout_OnLayoutChildren; OuterView = new StackLayout { Padding = new Thickness(50), BackgroundColor = Color.Yellow }; this.MainLayout.Children.Add(OuterView); OuterView.Layout(_outerLayoutBounds); Box = new BoxView { Color = Color.Red, WidthRequest = 150, HeightRequest = 150, }; OuterView.Children.Add(Box); var panRecognizer = new PanGestureRecognizer(); panRecognizer.IsConsumingTouchesInParallel = true; panRecognizer.OnAction += Gesture_OnAction; Box.AddGestureRecognizer(panRecognizer); Box2 = new BoxView(); Box2.Color = Color.Blue; this.MainLayout.Children.Add(Box2); Box2.Layout(_box2Bounds); panRecognizer = new PanGestureRecognizer(); panRecognizer.OnAction += Gesture_OnAction; panRecognizer.IsConsumingTouchesInParallel = true; Box2.AddGestureRecognizer(panRecognizer); DoBoxAnimation(); }
public void RespectMinimumWidthRequest() { var stack = new StackLayout { IsPlatformEnabled = true, Orientation = StackOrientation.Horizontal, Spacing = 10, Children = { new View { WidthRequest = 100, HeightRequest = 100, IsPlatformEnabled = true }, new View { WidthRequest = 100, HeightRequest = 100, IsPlatformEnabled = true }, new View { WidthRequest = 100, HeightRequest = 100, MinimumWidthRequest = 10, IsPlatformEnabled = true } } }; stack.Layout(new Rectangle(0, 0, 250, 100)); Assert.That(stack.Children.ToArray()[0].Frame, Is.EqualTo(new Rectangle(0, 0, 100, 100))); Assert.That(stack.Children.ToArray()[1].Frame, Is.EqualTo(new Rectangle(110, 0, 100, 100))); Assert.That(stack.Children.ToArray()[2].Frame, Is.EqualTo(new Rectangle(220, 0, 30, 100))); }
public void HFixedHorizontalStackFixesExpander() { var child1 = new BoxView { IsPlatformEnabled = true, }; var child2 = new BoxView { IsPlatformEnabled = true, HorizontalOptions = LayoutOptions.FillAndExpand }; var stack = new StackLayout { ComputedConstraint = LayoutConstraint.VerticallyFixed, Orientation = StackOrientation.Horizontal, IsPlatformEnabled = true, Children = { child1, child2 } }; stack.Layout(new Rectangle(0, 0, 200, 200)); Assert.AreEqual(LayoutConstraint.VerticallyFixed, child2.Constraint); }
public void TestVisibility() { View child1, child2; var stack = new StackLayout { IsPlatformEnabled = true, Children = { (child1 = new View { IsPlatformEnabled = true }), (child2 = new View { IsPlatformEnabled = true }) } }; stack.Layout(new Rectangle(0, 0, 100, 100)); var size = stack.GetSizeRequest(double.PositiveInfinity, double.PositiveInfinity).Request; Assert.AreEqual(new Rectangle(0, 0, 100, 20), child1.Bounds); Assert.AreEqual(new Rectangle(0, 26, 100, 20), child2.Bounds); Assert.AreEqual(new Size(100, 46), size); child1.IsVisible = false; Assert.False(child1.IsVisible); Assert.AreEqual(new Rectangle(0, 0, 100, 20), child2.Bounds); size = stack.GetSizeRequest(double.PositiveInfinity, double.PositiveInfinity).Request; Assert.AreEqual(new Size(100, 20), size); }
public void PaddingChildRelayoutTest() { var child = new BoxView { IsPlatformEnabled = true, WidthRequest = 20, HeightRequest = 20, }; var innerStack = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, IsPlatformEnabled = true, Children = { child } }; var outterLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, IsPlatformEnabled = true, Children = { innerStack } }; outterLayout.Layout(new Rectangle(0, 0, 100, 100)); var before = child.Bounds; innerStack.Padding = new Thickness(30); var after = child.Bounds; Assert.AreNotEqual(before, after, "child should be moved within padding size"); }
public void TestExpandHorizontal() { View child1, child2, child3; var stack = new StackLayout { IsPlatformEnabled = true, Orientation = StackOrientation.Horizontal, Children = { (child1 = new View { WidthRequest = 20, HeightRequest = 20, IsPlatformEnabled = true }), (child2 = new View { WidthRequest = 20, HeightRequest = 20, IsPlatformEnabled = true, HorizontalOptions = LayoutOptions.FillAndExpand }), (child3 = new View { WidthRequest = 20, HeightRequest = 20, IsPlatformEnabled = true }) } }; stack.Layout(new Rectangle(0, 0, 100, 100)); Assert.AreEqual(new Rectangle(0, 0, 20, 100), child1.Bounds); Assert.AreEqual(new Rectangle(26, 0, 100 - 2 * 26, 100), child2.Bounds); Assert.AreEqual(new Rectangle(80, 0, 20, 100), child3.Bounds); }
public void PaddingResizeTest() { var child = new BoxView { IsPlatformEnabled = true, WidthRequest = 20, HeightRequest = 20, }; var innerStack = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, IsPlatformEnabled = true, Children = { child } }; var outterLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, IsPlatformEnabled = true, Children = { innerStack } }; outterLayout.Layout(new Rectangle(0, 0, 100, 100)); var beforeSize = innerStack.Bounds.Size; innerStack.Padding = new Thickness(30); var afterSize = innerStack.Bounds.Size; Assert.AreNotEqual(beforeSize, afterSize, "Padding was grow, so Size should be bigger"); }
public void SpanningBoundsPortrait() { var testDualScreenService = new TestDualScreenServicePortrait(); testDualScreenService.IsSpanned = true; testDualScreenService.SetLocationOnScreen(new Point(400, 0)); var result = new StackLayout() { IsPlatformEnabled = true }; result.Layout(new Rectangle(400, 0, 200, testDualScreenService.ScaledScreenSize.Height)); DualScreenInfo info = new DualScreenInfo(result, testDualScreenService); var left = info.SpanningBounds[0]; Assert.AreEqual(0, left.X); Assert.AreEqual(0, left.Y); Assert.AreEqual(90, left.Width); Assert.AreEqual(testDualScreenService.ScaledScreenSize.Height, left.Height); var right = info.SpanningBounds[1]; Assert.AreEqual(110, right.X); Assert.AreEqual(0, right.Y); Assert.AreEqual(90, right.Width); Assert.AreEqual(testDualScreenService.ScaledScreenSize.Height, right.Height); }
public void RespectMinimumHeightRequest() { var stack = new StackLayout { IsPlatformEnabled = true, Spacing = 10, Children = { new View { WidthRequest = 100, HeightRequest = 100, IsPlatformEnabled = true }, new View { WidthRequest = 100, HeightRequest = 100, IsPlatformEnabled = true }, new View { WidthRequest = 100, HeightRequest = 100, MinimumHeightRequest = 10, IsPlatformEnabled = true } } }; stack.Layout(new Rectangle(0, 0, 100, 250)); Assert.That(stack.Children.ToArray()[0].Bounds, Is.EqualTo(new Rectangle(0, 0, 100, 100))); Assert.That(stack.Children.ToArray()[1].Bounds, Is.EqualTo(new Rectangle(0, 110, 100, 100))); Assert.That(stack.Children.ToArray()[2].Bounds, Is.EqualTo(new Rectangle(0, 220, 100, 30))); }
public void SpanningBoundsLandscape() { var testDualScreenService = new TestDualScreenServiceLandscape(); testDualScreenService.IsSpanned = true; testDualScreenService.SetLocationOnScreen(new Point(0, 400)); var result = new StackLayout() { IsPlatformEnabled = true }; result.Layout(new Rectangle(0, 400, testDualScreenService.ScaledScreenSize.Width, 200)); DualScreenInfo info = new DualScreenInfo(result, testDualScreenService); var top = info.SpanningBounds[0]; Assert.AreEqual(0, top.X); Assert.AreEqual(0, top.Y); Assert.AreEqual(testDualScreenService.ScaledScreenSize.Width, top.Width); Assert.AreEqual(90, top.Height); var bottom = info.SpanningBounds[1]; Assert.AreEqual(0, bottom.X); Assert.AreEqual(110, bottom.Y); Assert.AreEqual(testDualScreenService.ScaledScreenSize.Width, bottom.Width); Assert.AreEqual(90, bottom.Height); }
public void IntegrationTest() { var parent = new StackLayout { Spacing = 0, IsPlatformEnabled = true, }; var child1 = new Button { Text = "Test", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, IsPlatformEnabled = true, }; var child2 = new Button { Text = "Test", IsPlatformEnabled = true, }; child2.Margin = new Thickness(5, 10, 15, 20); parent.Children.Add(child1); parent.Children.Add(child2); parent.Layout(new Rectangle(0, 0, 1000, 1000)); Assert.AreEqual(new Rectangle(0, 0, 100, 50), child1.Bounds); Assert.AreEqual(new Rectangle(5, 60, 980, 50), child2.Bounds); child1.Margin = new Thickness(10, 20, 30, 40); Assert.AreEqual(new Rectangle(10, 20, 100, 50), child1.Bounds); Assert.AreEqual(new Rectangle(5, 120, 980, 50), child2.Bounds); }
public void RelayoutOnRemove() { var child1 = new BoxView { IsPlatformEnabled = true, }; var child2 = new BoxView { IsPlatformEnabled = true, }; var stack = new StackLayout { IsPlatformEnabled = true, Children = { child1, child2 } }; stack.Layout(new Rectangle(0, 0, 200, 200)); Assert.AreEqual(new Rectangle(0, 0, 200, 40), child1.Bounds); Assert.AreEqual(new Rectangle(0, 46, 200, 40), child2.Bounds); stack.Children.RemoveAt(0); Assert.AreEqual(new Rectangle(0, 0, 200, 40), child2.Bounds); }
public void VerticalRequestInHorizontalLayout() { var stack = new StackLayout { IsPlatformEnabled = true, Orientation = StackOrientation.Horizontal, Children = { new View { WidthRequest = 20, HeightRequest = 30, IsPlatformEnabled = true, VerticalOptions = LayoutOptions.Start }, new View { WidthRequest = 20, HeightRequest = 30, IsPlatformEnabled = true, VerticalOptions = LayoutOptions.Center }, new View { WidthRequest = 20, HeightRequest = 30, IsPlatformEnabled = true, VerticalOptions = LayoutOptions.End } } }; stack.Layout(new Rectangle(0, 0, 200, 200)); Assert.AreEqual(new Rectangle(0, 0, 20, 30), stack.Children.Cast <View>().ToArray()[0].Bounds); Assert.AreEqual(new Rectangle(26, 85, 20, 30), stack.Children.Cast <View>().ToArray()[1].Bounds); Assert.AreEqual(new Rectangle(52, 170, 20, 30), stack.Children.Cast <View>().ToArray()[2].Bounds); }
public void GetRectAfterRelayout2() //Add two group, then remove first group { var layout = new StackLayout(0, new Size(800, 600)); var size = new Size(200, 300); // Frame 0 layout.Begin(); { layout.BeginLayoutGroup(1, true); //add group 1 layout.GetRect(1, size); //add rect 1 layout.EndLayoutGroup(); layout.BeginLayoutGroup(2, true); //add group 2 layout.GetRect(2, size); //add rect 2 layout.EndLayoutGroup(); } layout.Layout(); // Frame 1 layout.Begin(); { //remove group 1 layout.BeginLayoutGroup(2, true); //get group 2 layout.GetRect(2, size); //get rect 2 layout.EndLayoutGroup(); } layout.Layout(); // Frame 2 layout.Begin(); { //group 1 removed layout.BeginLayoutGroup(2, true); //get group 2 var rect2 = layout.GetRect(2, size); //get rect 3 layout.EndLayoutGroup(); Assert.Equal(0, rect2.X); Assert.Equal(0, rect2.Y); Assert.Equal(size.Width, rect2.Width); Assert.Equal(size.Height, rect2.Height); } layout.Layout(); }
public void GetRectAfterRelayout4() { var layout = new StackLayout(0, new Size(800, 600)); var size = new Size(200, 300); // Frame 0 layout.Begin(); { layout.GetRect(1, size); layout.BeginLayoutGroup(1, true); layout.GetRect(2, size); layout.EndLayoutGroup(); layout.GetRect(3, size); layout.BeginLayoutGroup(2, true); layout.GetRect(4, size); layout.EndLayoutGroup(); } layout.Layout(); layout.Begin(); { layout.GetRect(1, size); layout.BeginLayoutGroup(1, true); layout.GetRect(2, size); layout.EndLayoutGroup(); layout.GetRect(3, size); layout.BeginLayoutGroup(2, true); layout.GetRect(4, size); layout.EndLayoutGroup(); } layout.Layout(); }
public void GetNormalRectAfterLayout() { var layout = new StackLayout(0, new Size(800, 600)); layout.Begin(); layout.GetRect(1, new Size(100, 30)); layout.Layout(); var rect = layout.GetRect(1, new Size(100, 30)); Assert.Equal(0, rect.X); Assert.Equal(0, rect.Y); Assert.Equal(100, rect.Width); Assert.Equal(30, rect.Height); }
public void GetRectWithExpandWidth(bool expandWidth, bool expandHeight) { var layout = new StackLayout(0, new Size(800, 600)); var size = new Size(200, 300); var options = GUILayout.ExpandWidth(expandWidth).ExpandHeight(expandHeight); layout.Begin(); layout.GetRect(1, size, options); layout.Layout(); var rect = layout.GetRect(1, size, options); Assert.Equal(0, rect.X); Assert.Equal(0, rect.Y); Assert.Equal(expandWidth ? 800 : size.Width, rect.Width); Assert.Equal(expandHeight ? 600 : size.Height, rect.Height); }
public void IntegrationTest() { var parent = new StackLayout { Spacing = 0, IsPlatformEnabled = true, }; var handler = Substitute.For <IViewHandler>(); parent.Handler = handler; var child1 = new Button { Text = "Test", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, IsPlatformEnabled = true, }; var child2 = new Button { Text = "Test", IsPlatformEnabled = true, }; child2.Margin = new Thickness(5, 10, 15, 20); parent.Children.Add(child1); parent.Children.Add(child2); parent.Layout(new Rectangle(0, 0, 1000, 1000)); Assert.AreEqual(new Rectangle(0, 0, 100, 50), child1.Bounds); Assert.AreEqual(new Rectangle(5, 60, 980, 50), child2.Bounds); child1.Margin = new Thickness(10, 20, 30, 40); // Verify that the margin change invalidated the layout, and simulate a native layout change AssertInvalidated(handler); parent.ForceLayout(); Assert.AreEqual(new Rectangle(10, 20, 100, 50), child1.Bounds); Assert.AreEqual(new Rectangle(5, 120, 980, 50), child2.Bounds); }
public void GetRectWithFixedWidthAndHeight() { var layout = new StackLayout(0, new Size(800, 600)); var size = new Size(200, 300); const int fixedWidth = 100; const int fixedHeight = 200; var options = GUILayout.Width(fixedWidth).Height(fixedHeight); layout.Begin(); layout.GetRect(1, size, options); layout.Layout(); var rect = layout.GetRect(1, size, options); Assert.Equal(0, rect.X); Assert.Equal(0, rect.Y); Assert.Equal(fixedWidth, rect.Width); Assert.Equal(fixedHeight, rect.Height); }
public void TheWTFTest() { var child1 = new BoxView { IsPlatformEnabled = true, WidthRequest = 20, HeightRequest = 20, MinimumWidthRequest = 10, MinimumHeightRequest = 10, VerticalOptions = LayoutOptions.FillAndExpand }; var stack = new StackLayout { IsPlatformEnabled = true, Children = { child1 } }; stack.Layout(new Rectangle(0, 0, 100, 100)); }
public void GetRectWithBorder() { var layout = new StackLayout(0, new Size(800, 600)); var size = new Size(200, 300); var style = new GUIStyle(); style.Border = (1, 2, 3, 4); //FIXME per-entry style modification layout.Begin(); layout.GetRect(1, size); layout.Layout(); var rect = layout.GetRect(1, size); Assert.Equal(0, rect.X); Assert.Equal(0, rect.Y); Assert.Equal(size.Width + style.BorderHorizontal, rect.Width); Assert.Equal(size.Height + style.BorderVertical, rect.Height); }
void Gesture_OnAction(BaseGestureRecognizer recgonizer, GestureRecognizerState state) { string message = ""; var panGesture = recgonizer as PanGestureRecognizer; Point translation = panGesture.GetTranslationInView(MainLayout); Point velocity = panGesture.GetVelocityInView(MainLayout); panGesture.SetTranslationInView(new Point(0, 0), MainLayout); switch (panGesture.State) { case GestureRecognizerState.Began: message += "BEGAN "; message += "POS: " + recgonizer.LocationInView(MainLayout); break; case GestureRecognizerState.Changed: message += "CHANGED "; message += ", translation: " + translation; message += ", velocity: " + velocity; message += "POS: \n" + recgonizer.LocationInView(panGesture.View).PrettyPrint(); message += "PARENT POS: \n" + recgonizer.LocationInView(MainLayout).PrettyPrint(); if (recgonizer.View == Box) { message += ", MOVING VIEW"; _outerLayoutBounds.X += translation.X; _outerLayoutBounds.Y += translation.Y; OuterView.Layout(_outerLayoutBounds); } break; case GestureRecognizerState.Cancelled: case GestureRecognizerState.Ended: case GestureRecognizerState.Failed: message += "FINISHED "; break; case GestureRecognizerState.Possible: default: break; } OutputLabel.Text = message; }
public void PaddingResizeTest() { var child = new BoxView { IsPlatformEnabled = true, WidthRequest = 20, HeightRequest = 20, }; var innerStack = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, IsPlatformEnabled = true, Children = { child } }; var outerLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, IsPlatformEnabled = true, Children = { innerStack } }; var handler = Substitute.For <IViewHandler>(); outerLayout.Handler = handler; outerLayout.Layout(new Rectangle(0, 0, 100, 100)); var beforeSize = innerStack.Bounds.Size; innerStack.Padding = new Thickness(30); // Verify that the Padding change invalidated the layout, and simulate a native layout update AssertInvalidated(handler); outerLayout.ForceLayout(); var afterSize = innerStack.Bounds.Size; Assert.AreNotEqual(beforeSize, afterSize, "Padding was grow, so Size should be bigger"); }
public void NestedMinimumSizeOverflow() { var stack = new StackLayout { IsPlatformEnabled = true, Spacing = 0 }; var hbox = new StackLayout { IsPlatformEnabled = true, Spacing = 0, Orientation = StackOrientation.Horizontal }; View child1, child2; hbox.Children.Add(child1 = new View { IsPlatformEnabled = true, WidthRequest = 100, HeightRequest = 100, MinimumWidthRequest = 10, MinimumHeightRequest = 10 }); hbox.Children.Add(child2 = new View { IsPlatformEnabled = true, WidthRequest = 100, HeightRequest = 100, MinimumWidthRequest = 10, MinimumHeightRequest = 10 }); stack.Children.Add(hbox); stack.Layout(new Rectangle(0, 0, 70, 70)); Assert.AreEqual(new Rectangle(0, 0, 70, 70), stack.Bounds); Assert.AreEqual(new Rectangle(0, 0, 35, 70), child1.Bounds); Assert.AreEqual(new Rectangle(35, 0, 35, 70), child2.Bounds); }
protected override void LayoutChildren(double x, double y, double width, double height) { if (rootPage == null) { var page = Navigation.NavigationStack.LastOrDefault(); rootPage = GetRootPage(page); } if (rootPage != null) { if (rootPage.Content.AutomationId != PageRootGridId.ToString()) { var rootGrid = new Grid() { AutomationId = PageRootGridId.ToString() }; var content = rootPage.Content; rootPage.Content = null; rootGrid.Children.Add(content); content.Parent = rootGrid; rootGrid.Children.Add(popupStack); popupStack.Parent = rootGrid; rootPage.Content = rootGrid; rootGrid.Parent = rootPage; rootGrid.RaiseChild(popupStack); } else { var rootGrid = rootPage.Content as Grid; popupStack.Layout(new Rectangle(x, y, popupStack.WidthRequest, height)); rootGrid.Children.Add(popupStack); popupStack.Parent = rootGrid; rootGrid.RaiseChild(popupStack); } } base.LayoutChildren(x, y, width, height); }