protected override Vector2 MeasureOverride(Vector2 availableSize) { Thickness borderThicknessAndPadding = this.BorderThickness + this.Padding; UIElement child = this.Content; if (child != null) { child.Measure(availableSize.Deflate(borderThicknessAndPadding)); return(child.DesiredSize.Inflate(borderThicknessAndPadding)); } return(borderThicknessAndPadding.Collapse()); }