public static Form ShowXamarinControl(this ContentPage ctl, int Width, int Height) { var f = new Xamarin.Forms.Platform.WinForms.PlatformRenderer(); Xamarin.Forms.Platform.WinForms.Forms.Init(f); f.Width = Width; f.Height = Height; var done = false; Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { var app = new Xamarin.Forms.Application() { MainPage = ctl }; f.LoadApplication(app); ThemeManager.ApplyThemeTo(f); if (ctl is IClose) { ((IClose)ctl).CloseAction = () => f.Close(); } f.ShowDialog(); done = true; }); while (!done) { Application.DoEvents(); } return(f); }
static void Main() { OpenTK.Toolkit.Init(); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); var f = new Xamarin.Forms.Platform.WinForms.PlatformRenderer(); Xamarin.Forms.Platform.WinForms.Forms.Init(f); f.Width = 800; f.Height = 600; f.LoadApplication(new App()); System.Windows.Forms.Application.Run(f); }
public static Form ShowXamarinControl(this ContentPage ctl, int Width, int Height) { var f = new Xamarin.Forms.Platform.WinForms.PlatformRenderer(); Xamarin.Forms.Platform.WinForms.Forms.Init(f); f.Width = Width; f.Height = Height; var app = new Xamarin.Forms.Application() { MainPage = ctl }; f.LoadApplication(app); ThemeManager.ApplyThemeTo(f); if (ctl is IClose) { ((IClose)ctl).CloseAction = () => f.Close(); } f.ShowDialog(); return(f); }