protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Xamarin.Forms.Forms.Init(); BlazorHybridWindows.Init(); // create a Xamarin Forms ContentPage container var xfContentPage = new Xamarin.Forms.ContentPage(); // add MBB Hybrid Blazor/Xamarin components as-needed to that container _host.AddComponent <Main>(parent: xfContentPage); // optional, create a vanilla WPF container of some sort (here, a Grid) var grid = new System.Windows.Controls.Grid(); // create a top-level vanilla WPF window, with the Grid as it's content var window = new Window { Content = grid }; // add the Xamarin container to the WPF grid (can safely add other WPF elements to the grid as well) grid.Children.Add(xfContentPage.ToFrameworkElement()); // show the top-level vanilla WPF window window.Show(); }
public MainPage() { InitializeComponent(); HelloFlyout.Content = new Hello().CreateFrameworkElement(); _page4 = new Page4(); }
/// <summary> /// Create an android host instance associated wth the specified activity and stateful container function. /// </summary> /// <param name="contentPage"></param> /// <param name="containerFactory"></param> /// <returns></returns> public static XamFormsBuildHostInstance Create(Xamarin.Forms.ContentPage contentPage, RootContainerFactory containerFactory) { if (_instance == null) { throw new InvalidOperationException("Host has not been initialized\n Add BuildHost.CreateHost(<<environment>>,optional <<hostFactory>>) to your application initialization code."); } return(_instance.CreateInstance(contentPage, containerFactory)); }
protected override void BindPage(Xamarin.Forms.ContentPage page) { page.Appearing += delegate { RequestedRotation = DeviceRotation.Portrait; }; page.Disappearing += delegate { RequestedRotation = DeviceRotation.Unknown; }; }
public AppUpdateUtils(Xamarin.Forms.ContentPage page) { mPage = page; }
/// <summary> /// Create a host instance. /// </summary> /// <param name="contentPage"></param> /// <param name="containerFactory"></param> /// <returns></returns> private XamFormsBuildHostInstance CreateInstance(Xamarin.Forms.ContentPage contentPage, RootContainerFactory containerFactory) { var instanceHost = _hostFactory(contentPage, _hostEnvironment, containerFactory); return(instanceHost); }