public override Size GetDesiredSize(double widthConstraint, double heightConstraint) { var platformView = this.ToPlatform(); if (platformView == null || VirtualView == null) { return(new Size(widthConstraint, heightConstraint)); } VirtualView.CrossPlatformMeasure(widthConstraint, heightConstraint); var explicitWidth = VirtualView.Width; var explicitHeight = VirtualView.Height; var hasExplicitWidth = explicitWidth >= 0; var hasExplicitHeight = explicitHeight >= 0; var sizeThatFits = platformView.SizeThatFits(new CGSize((float)widthConstraint, (float)heightConstraint)); var size = new Size( sizeThatFits.Width > 0 ? sizeThatFits.Width : PlatformView.ContentSize.Width, sizeThatFits.Height > 0 ? sizeThatFits.Height : PlatformView.ContentSize.Height); return(new Size(hasExplicitWidth ? explicitWidth : size.Width, hasExplicitHeight ? explicitHeight : size.Height)); }
public override Size GetDesiredSize(double widthConstraint, double heightConstraint) { var result = base.GetDesiredSize(widthConstraint, heightConstraint); if (GetInsetPanel(NativeView) == null) { VirtualView.CrossPlatformMeasure(widthConstraint, heightConstraint); } return(result); }
public override Graphics.Size GetDesiredSize(double widthConstraint, double heightConstraint) { return(VirtualView.CrossPlatformMeasure(widthConstraint, heightConstraint)); }