Created
May 6, 2020 06:45
-
-
Save lubiepomaranczki/40889087a9063748b48fc1e4c891550d to your computer and use it in GitHub Desktop.
Solution to the problem described here https://twitter.com/lawiluk/status/1257661151258820608 Solution proposed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FormsTestView : BaseViewController<FormsTestViewModel> | |
{ | |
public override void ViewDidLoad() | |
{ | |
base.ViewDidLoad(); | |
EdgesForExtendedLayout = UIRectEdge.None; | |
View.BackgroundColor = UIColor.Green; | |
Xamarin.Forms.Forms.Init(); | |
var page = new FormsTestPage { BindingContext = ViewModel }; | |
var formsViewController = page.CreateViewController(); | |
formsViewController.View.TranslatesAutoresizingMaskIntoConstraints = false; | |
formsViewController.WillMoveToParentViewController(this); | |
formsViewController.ViewWillAppear(true); | |
View.Add(formsViewController.View); | |
formsViewController.View.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active = true; | |
formsViewController.View.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active = true; | |
formsViewController.View.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active = true; | |
formsViewController.View.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; | |
formsViewController.ViewDidAppear(true); | |
formsViewController.DidMoveToParentViewController(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment