private void Shell_BackRequested(object sender, BackRequestedEventArgs e) { if (ShellFrame.CanGoBack) { ShellFrame.GoBack(); e.Handled = true; } }
private void OnNavButtonClick(object sender, RoutedEventArgs e) { RadioButton selectedNav = sender as RadioButton; if (NavigationDictionary[selectedNav] != ShellFrame.CurrentSourcePageType) { ShellFrame.Navigate(NavigationDictionary[selectedNav]); } }
public FlightReservationWindow(SearchQuery queryObject) { this.InitializeComponent(); _queryObject = queryObject; ShellFrame.Navigate(typeof(FlightReservationPage), _queryObject); PaymentButton.Click += PaymentButton_Click; }
private void ShellNavigationView_Loaded(object sender, RoutedEventArgs e) { foreach (NavigationViewItem item in NavigationItems) { ShellNavigationView.MenuItems.Add(item); } // naviagte to home page by default LastPage = "Home"; ShellFrame.Navigate(typeof(Home)); // next two lines make it so that the small colored rectangle (indicator) is shown next to the home nav item ShellNavigationView.SelectedItem = NavigationItems[0]; ShellNavigationView.UpdateLayout(); }
public AppShell(string path) { // Init the XAML LoggingService.Log(LoggingService.LogType.Debug, "Loading Shell XAML"); InitializeComponent(); // Set the accent color TitlebarHelper.UpdateTitlebarStyle(); LoggingService.Log(LoggingService.LogType.Debug, "Attaching Event Handlers"); // When the page is loaded (after the following and xaml init) // we can perform the async work Loaded += async(sender, args) => await PerformAsyncWork(path); // Unload events Unloaded += (sender, args) => Dispose(); var titleBar = CoreApplication.GetCurrentView().TitleBar; titleBar.LayoutMetricsChanged += (s, e) => { AppTitle.Margin = new Thickness(CoreApplication.GetCurrentView().TitleBar.SystemOverlayLeftInset + 12, 8, 0, 0); }; // This is a dirty to show the now playing // bar when a track is played. This method // updates the required layout for the now // playing bar. PlaybackService.Instance.OnTrackChange += InstanceOnOnCurrentTrackChanged; // Create a shell frame shadow for mobile and desktop if (DeviceHelper.IsDesktop) { ShellFrame.CreateElementShadow(new Vector3(4, 0, 0), 40, new Color { A = 82, R = 0, G = 0, B = 0 }, ShellFrameShadow); } // Events for Xbox if (DeviceHelper.IsXbox) { // Make xbox selection easy to see Application.Current.Resources["CircleButtonStyle"] = Application.Current.Resources["XboxCircleButtonStyle"]; } RootFrame.Focus(FocusState.Keyboard); }
private void ShellNavigationView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) { if (args.IsSettingsInvoked) { LastPage = "Settings"; ShellFrame.Navigate(typeof(Settings)); return; // don't do anything else } string clickedNavigationItem = args.InvokedItem.ToString(); if (clickedNavigationItem == LastPage) { // don't navigate to page if already navigated to (duh!) Debug.Out("Navigation was annulled (tried going to the page already navigated to)"); return; } else { LastPage = clickedNavigationItem; } Debug.Out("Navigating to " + clickedNavigationItem); switch (clickedNavigationItem) { case "Home": ShellFrame.Navigate(typeof(Home)); break; case "Redirections": ShellFrame.Navigate(typeof(Redirections)); break; case "Core Modules": ShellFrame.Navigate(typeof(CoreModules)); break; default: Debug.Out("Unknown page \"" + clickedNavigationItem + "\" could not be navigated to", "WARNING"); break; } }
private void PaymentButton_Click(object sender, RoutedEventArgs e) { switch (currentStep) { case 0: ShellFrame.Navigate(typeof(PaymentPage)); break; case 1: ShellFrame.Navigate(typeof(BoardingPass)); PaymentButton.Content = "Finish"; break; case 2: this.Close(); break; } currentStep++; }
private void HamburgerMenu_Navigate(NavigationViewItem item) { if (item.Tag.ToString().Equals(CurrentPageTag)) { // ex. at Home, tried to navigate to Home again // System.Diagnostics.Debug.WriteLine("Tried to navigate to the current page again (given: " + item.Tag.ToString() + ", current: " + CurrentPageTag + ")"); return; } switch (item.Tag) { case "home": ShellFrame.Navigate(typeof(Pages.Home)); break; case "page2": ShellFrame.Navigate(typeof(Pages.Page2)); break; } }
public MainShell(string path) { // Init the XAML InitializeComponent(); // Set the accent color TitlebarHelper.UpdateTitlebarStyle(); // When the page is loaded (after the following and xaml init) // we can perform the async work Loaded += async(sender, args) => await PerformAsyncWork(path); // Unload events Unloaded += (sender, args) => Dispose(); // This is a dirty to show the now playing // bar when a track is played. This method // updates the required layout for the now // playing bar. PlaybackService.Instance.PropertyChanged += ServiceOnPropertyChanged; // Create a shell frame shadow for mobile and desktop if (DeviceHelper.IsDesktop || DeviceHelper.IsMobile) { ShellFrame.CreateElementShadow(new Vector3(0, 0, 0), 20, new Color { A = 52, R = 0, G = 0, B = 0 }, ShellFrameShadow); } // Events for Xbox if (DeviceHelper.IsXbox) { // Pane is hidden by default MainSplitView.IsPaneOpen = false; MainSplitView.DisplayMode = SplitViewDisplayMode.CompactOverlay; MainSplitView.Margin = new Thickness(); MainSplitView.LightDismissOverlayMode = LightDismissOverlayMode.On; // Center all navigation icons NavbarScrollViewer.VerticalAlignment = VerticalAlignment.Center; // Show background blur image XboxOnlyGrid.Visibility = Visibility.Visible; ShellFrame.Background = new SolidColorBrush(Colors.Transparent); // Splitview pane gets background SplitViewPaneGrid.Background = Application.Current.Resources["InAppBackgroundBrush"] as CustomAcrylicBrush; // Make xbox selection easy to see Application.Current.Resources["CircleButtonStyle"] = Application.Current.Resources["XboxCircleButtonStyle"]; } // Events for Mobile if (DeviceHelper.IsMobile) { // Splitview pane gets background SplitViewPaneGrid.Background = Application.Current.Resources["MobileBlurHeader"] as CustomAcrylicBrush; // Amoled Magic Application.Current.Resources["ShellBackground"] = new SolidColorBrush(Application.Current.RequestedTheme == ApplicationTheme.Dark ? Colors.Black : Colors.White); MainSplitView.IsPaneOpen = false; MainSplitView.DisplayMode = SplitViewDisplayMode.Overlay; MainSplitView.Margin = new Thickness(0); SplitViewPaneGrid.Margin = new Thickness { Top = 48 }; MobileMenu.Visibility = Visibility.Visible; HamburgerButton.Visibility = Visibility.Collapsed; } if (DeviceHelper.IsDesktop) { MainSplitView.IsPaneOpen = SettingsService.Instance.IsMenuOpen; } // Focus on the root frame RootFrame.Focus(FocusState.Programmatic); }