public override void LayoutSubviews() { float lastY = this.Bounds.Y + Padding; float maxWidth = 0; if (CenterItems) { var totalHeight = Subviews.Sum(x => x.Frame.Height + Padding) - Padding; if (totalHeight < Bounds.Height) { lastY = (Bounds.Height - totalHeight) / 2; } } foreach (var view in Subviews) { var rect = view.Frame; if (StretchWidth) { rect.Width = this.Bounds.Width - (Padding * 2); } rect.X = Padding + this.Bounds.X; rect.Y = lastY; view.Frame = rect; if (maxWidth < rect.Width) { maxWidth = rect.Width; } lastY += rect.Height + Padding; } if (ParentScrollView != null) { ParentScrollView.ContentSize = new SizeF(maxWidth, lastY); } }