private protected override void OnConnectHandler(FrameworkElement platformView) { base.OnConnectHandler(platformView); NavigationFrame.Navigated += OnNavigated; // If CreatePlatformView didn't set the NavigationView then that means we are using the // WindowRootView for our tabs if (_navigationView == null) { SetupNavigationLocals(); } else { SetupNavigationView(); } if (_navigationView == null && _navigationRootManager?.RootView is WindowRootView wrv) { wrv.ContentChanged += OnContentChanged; void OnContentChanged(object?sender, EventArgs e) { wrv.ContentChanged -= OnContentChanged; SetupNavigationLocals(); } } void SetupNavigationLocals() { _navigationRootManager = MauiContext?.GetNavigationRootManager(); _navigationView = (_navigationRootManager?.RootView as WindowRootView)?.NavigationViewControl; SetupNavigationView(); } }
protected override void DisconnectHandler(AActivity platformView) { base.DisconnectHandler(platformView); var windowManager = MauiContext.GetNavigationRootManager(); windowManager.Disconnect(); }
protected override FrameworkElement CreatePlatformView() { _navigationFrame = new WFrame(); if (VirtualView.FindParentOfType <FlyoutPage>() != null) { _navigationView = new MauiNavigationView() { Content = _navigationFrame, PaneDisplayMode = NavigationViewPaneDisplayMode.LeftMinimal, IsBackButtonVisible = NavigationViewBackButtonVisible.Collapsed, IsSettingsVisible = false, IsPaneToggleButtonVisible = false }; // Unset styles set by parent NavigationView _navigationView.SetApplicationResource("NavigationViewContentMargin", null); _navigationView.SetApplicationResource("NavigationViewMinimalHeaderMargin", null); _navigationView.SetApplicationResource("NavigationViewHeaderMargin", null); _navigationView.SetApplicationResource("NavigationViewMinimalContentGridBorderThickness", null); return(_navigationView); } _navigationRootManager = MauiContext?.GetNavigationRootManager(); return(_navigationFrame); }
AView GetCurrentRootView() { return(MauiContext ?.GetNavigationRootManager() ?.RootView ?? throw new InvalidOperationException("Current Root View cannot be null")); }
void UpdateContent() { _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); var rootManager = MauiContext.GetNavigationRootManager(); rootManager.Connect(VirtualView.Content); }
protected override void DisconnectHandler(UI.Xaml.Window platformView) { var windowManager = MauiContext.GetNavigationRootManager(); var rootPanel = platformView.Content as WPanel; rootPanel.Children.Remove(windowManager.RootView); windowManager.Disconnect(); base.DisconnectHandler(platformView); }
protected override void DisconnectHandler(UI.Xaml.Window platformView) { MauiContext ?.GetNavigationRootManager() ?.Disconnect(); _rootPanel?.Children?.Clear(); platformView.Content = null; base.DisconnectHandler(platformView); }
protected override void DisconnectHandler(UI.Xaml.Window nativeView) { var windowManager = MauiContext?.GetNavigationRootManager(); windowManager?.Disconnect(VirtualView.Content); _rootPanel?.Children?.Clear(); nativeView.Content = null; base.DisconnectHandler(nativeView); }
private protected override void OnDisconnectHandler(object platformView) { base.OnDisconnectHandler(platformView); if (platformView is MauiToolbar mauiToolbar) { var navRootManager = MauiContext?.GetNavigationRootManager(); if (navRootManager?.ToolBar == mauiToolbar) { navRootManager.SetToolbar(null); } } }
protected override void DisconnectHandler(UI.Xaml.Window platformView) { MauiContext ?.GetNavigationRootManager() ?.Disconnect(); if (platformView.Content is WindowRootViewContainer container) { container.Children.Clear(); platformView.Content = null; } base.DisconnectHandler(platformView); }
void UpdateContent() { _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); var rootManager = MauiContext.GetNavigationRootManager(); var previousRootView = rootManager.RootView; rootManager.Connect(VirtualView.Content); // This is used for cases where we are testing swapping out the page set on window if (previousRootView?.Parent is FakeActivityRootView farw) { previousRootView.RemoveFromParent(); rootManager.RootView.LayoutParameters = new LinearLayoutCompat.LayoutParams(500, 500); farw.AddView(rootManager.RootView); } }
void UpdateDetail() { _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); _ = VirtualView.Detail?.ToNative(MauiContext); var newDetailView = VirtualView.Detail?.GetNative(true); if (_detailView == newDetailView) { return; } if (_detailView != null) { _detailView.RemoveFromParent(); } _detailView = newDetailView; MauiContext .GetNavigationRootManager() .SetContentView(_detailView, MauiContext.GetFragmentManager()); }
protected override void ConnectHandler(RootNavigationView platformView) { _navigationRootManager = MauiContext?.GetNavigationRootManager(); platformView.PaneOpened += OnPaneOepened; }