public override void OnLayout(IGUIContext ctx, RectangleF bounds) { base.OnLayout(ctx, bounds); float preferredHeight = ContentPanel.PreferredSize(ctx, bounds.Size).Height; preferredHeight = Math.Min(preferredHeight, bounds.Height); float marginHeight = ((bounds.Height - preferredHeight) / 2); ContentPanel.Margin = new Padding(0, marginHeight, 0, marginHeight); ContentPanel.Padding = new Padding(16); }