public MainView() { this.InitializeComponent(); var channelService = Locator.Current.GetService <IChannelService>(); var discoveryService = Locator.Current.GetService <IDiscoveryService>(); var blobCache = BlobCache.UserAccount; ViewModel = new MainViewModel(discoveryService, channelService, blobCache); StateViewModel = new ConnectionStateViewModel(channelService); // The settings var settingsViewModel = new SettingsViewModel(ViewModel, this, blobCache); Locator.CurrentMutable.RegisterLazySingleton(() => settingsViewModel, typeof(IRoutableViewModel), "Settings"); Window.Current.SetTitleBar(AppTitleBar); //CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; CoreApplication.GetCurrentView().TitleBar.LayoutMetricsChanged += (s, e) => UpdateAppTitle(s); // remove the solid-colored backgrounds behind the caption controls and system back button // This is done when the app is loaded since before that the actual theme that is used is not "determined" yet Loaded += (sender, e) => UpdateTitleBar(true); NavigationViewControl.RegisterPropertyChangedCallback(Muxc.NavigationView.PaneDisplayModeProperty, new DependencyPropertyChangedCallback(OnPaneDisplayModeChanged)); ViewModel.NavigateTo.Execute("Connection").Subscribe(); }
protected override void OnContentChanged(object oldContent, object newContent) { base.OnContentChanged(oldContent, newContent); if (newContent is MauiNavigationView mnv) { NavigationViewControl = mnv; NavigationViewControl.DisplayModeChanged += OnNavigationViewControlDisplayModeChanged; NavigationViewControl.BackRequested += OnNavigationViewBackRequested; NavigationViewControl.RegisterPropertyChangedCallback(NavigationView.IsBackButtonVisibleProperty, AppBarNavigationIconsChanged); NavigationViewControl.RegisterPropertyChangedCallback(NavigationView.IsPaneToggleButtonVisibleProperty, AppBarNavigationIconsChanged); } }