void Control_Click(object sender, EventArgs e) { var formsView = new CommonFormsView(); var nativeConverted = FormsToNativeDroid.ConvertFormsToNative(formsView, new Rectangle(0, 0, 400, 400)); var builder = new AlertDialog.Builder(Forms.Context); builder.SetView(nativeConverted); builder.SetTitle("Forms View"); var dialog = builder.Create(); dialog.Show(); }
protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.Button> e) { base.OnElementChanged(e); if (e.NewElement != null) { Control.TouchUpInside += delegate(object sender, EventArgs e2) { var formsView = new CommonFormsView(); var rect = new CGRect(0, 0, 400, 400); var iOSView = FormsViewToNativeiOS.ConvertFormsToNative(formsView, rect); var viewController = new UIViewController(); viewController.Add(iOSView); viewController.View.Frame = rect; var popoverController = new UIPopoverController(viewController); popoverController.ContentViewController.View.BackgroundColor = viewController.View.BackgroundColor; popoverController.PopoverContentSize = rect.Size; var frame = UIApplication.SharedApplication.KeyWindow.RootViewController.View.Frame; popoverController.PresentFromRect(Control.Frame, UIApplication.SharedApplication.KeyWindow.RootViewController.View, 0, true); }; } }