protected override void OnNavigatedTo(global::Windows.UI.Xaml.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter == null) { throw new InvalidOperationException($"Cannot navigate to {nameof(FormsEmbeddedPageWrapper)} without " + $"providing a {nameof(System.Maui.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 OnNavigatedTo(global::Windows.UI.Xaml.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (this.OnNavigatedToCommand != null && e.Parameter != null) { this.OnNavigatedToCommand.Execute(e.Parameter); } }
/// <summary> /// Restores the content transitions after the app has launched. /// </summary> /// <param name="sender">The object where the handler is attached.</param> /// <param name="e">Details about the navigation event.</param> void RootFrame_FirstNavigated(object sender, global::Windows.UI.Xaml.Navigation.NavigationEventArgs e) { var rootFrame = sender as global::Windows.UI.Xaml.Controls.Frame; rootFrame.ContentTransitions = _transitions ?? new TransitionCollection() { new NavigationThemeTransition() }; rootFrame.Navigated -= RootFrame_FirstNavigated; }
void FacadeNavigatedEventHandler(object sender, global::Windows.UI.Xaml.Navigation.NavigationEventArgs e) { CurrentPageType = e.SourcePageType; CurrentPageParam = e.Parameter; var args = new NavigatedEventArgs(e, Content as Page); if (NavigationModeHint != NavigationMode.New) { args.NavigationMode = NavigationModeHint; } NavigationModeHint = NavigationMode.New; foreach (var handler in _navigatedEventHandlers) { handler(this, args); } }
protected virtual void OnNavigatedTo(global::Windows.UI.Xaml.Navigation.NavigationEventArgs e) { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Xaml.Controls.Page", "void Page.OnNavigatedTo(NavigationEventArgs e)"); }
private async void _frame_Navigated(object sender, global::Windows.UI.Xaml.Navigation.NavigationEventArgs e) { if (NavigationMode.New == e.NavigationMode) { try { if (null != CurrentPage) { if (CurrentPage.DataContext is INavigationAware navigationAware) { await navigationAware.OnNavigatedFromAsync(); } } } catch (Exception ex) { Logger.Technical.From <NavigationService>().Exception(ex).Log(); } try { if (e.Content is Page page && page.DataContext is INavigationAware navigationAware) { CurrentPage = page; await navigationAware.OnNavigatedToAsync(e.Parameter as Dictionary <string, object>); } } catch (Exception ex) { Logger.Technical.From <NavigationService>().Exception(ex).Log(); } } if (NavigationMode.Back == e.NavigationMode && null != CurrentPage) // shoul be always true! { try { if (CurrentPage.DataContext is INavigationAware navigationAware) { await navigationAware.OnNavigatedFromAsync(); } } catch (Exception ex) { Logger.Technical.From <NavigationService>().Exception(ex).Log(); } try { if (e.Content is Page page && page.DataContext is INavigationAware navigationAware) { CurrentPage = page; await navigationAware.OnNavigatedToAsync(new Dictionary <string, object>() { { "Back", true } }); } } catch (Exception ex) { Logger.Technical.From <NavigationService>().Exception(ex).Log(); } } NavigationChanged?.Invoke(sender, e); }