protected override void OnNavigatedTo(Microsoft.UI.Xaml.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter == null) { throw new InvalidOperationException($"Cannot navigate to {nameof(FormsEmbeddedPageWrapper)} without " + $"providing a {nameof(Xamarin.Forms.Page)} identifier."); } // Find the page instance in the dictionary and then discard it so we don't prevent it from being collected var key = (Guid)e.Parameter; var page = Pages[key]; Pages.Remove(key); // Convert that page into a FrameWorkElement we can display in the ContentPresenter FrameworkElement frameworkElement = page.CreateFrameworkElement(); if (frameworkElement == null) { throw new InvalidOperationException($"Could not find or create a renderer for the Page {page}"); } Root.Content = frameworkElement; }
protected override void OnNavigatedFrom(Microsoft.UI.Xaml.Navigation.NavigationEventArgs e) { base.OnNavigatedFrom(e); Root.Content = null; }
protected override void OnNavigatedTo(Microsoft.UI.Xaml.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); LoadPage(); }