private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e) { if (e.NavigationMode == NavigationMode.Back) { var item = (from p in this.navlist where p.DestPage == e.SourcePageType select p).SingleOrDefault(); if (item == null && this.AppFrame.BackStackDepth > 0) { foreach (var entry in this.AppFrame.BackStack.Reverse()) { item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).SingleOrDefault(); if (item != null) { break; } } } var container = (ListViewItem)NavMenuList.ContainerFromItem(item); if (container != null) { container.IsTabStop = false; } NavMenuList.SetSelectedItem(container); if (container != null) { container.IsTabStop = true; } } }
private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e) { if (e.NavigationMode == NavigationMode.Back) { var item = (from p in this.navlist where p.DestPage == e.SourcePageType select p).SingleOrDefault(); if (item == null && this.AppFrame.BackStackDepth > 0) { // In cases where a page drills into sub-pages then we'll highlight the most recent // navigation menu item that appears in the BackStack foreach (var entry in this.AppFrame.BackStack.Reverse()) { item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).SingleOrDefault(); if (item != null) { break; } } } var container = (ListViewItem)NavMenuList.ContainerFromItem(item); if (container != null) { container.IsTabStop = false; } NavMenuList.SetSelectedItem(container); if (container != null) { container.IsTabStop = true; } } }
/// <summary> /// Ensures the nav menu reflects reality when navigation is triggered outside of /// the nav menu buttons. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e) { if (e.NavigationMode == NavigationMode.Back) { var item = (from p in this.navlist where p.DestPage == e.SourcePageType select p).SingleOrDefault(); if (item == null && this.AppFrame.BackStackDepth > 0) { // In cases where a page drills into sub-pages then we'll highlight the most recent // navigation menu item that appears in the BackStack foreach (var entry in this.AppFrame.BackStack.Reverse()) { item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).SingleOrDefault(); if (item != null) { break; } } } var container = (ListViewItem)NavMenuList.ContainerFromItem(item); // While updating the selection state of the item prevent it from taking keyboard focus. If a // user is invoking the back button via the keyboard causing the selected nav menu item to change // then focus will remain on the back button. if (container != null) { container.IsTabStop = false; } NavMenuList.SetSelectedItem(container); if (container != null) { container.IsTabStop = true; } } }
public PageShell() { InitializeComponent(); (SpecificUtils.hudPopup as HUDPopup_UWP).Init(msgBar, msgBox); NavMenuList.ItemsSource = navList; NavMenuList.PageSelected += OnPageSelected; frame.NavigationFailed += (o, e) => e.Exception.CopeWith("page navigation"); Loaded += (o, e) => NavMenuList.Select(0); }
public MainPage() { this.InitializeComponent(); SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; NavMenuList.SelectedIndex = 0; NavMenuList.SetSelectedItem(NavMenuList.Items[0] as NavMenuItem); if (!(Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported())) { FeedbackNavPaneButton.Visibility = Visibility.Collapsed; FeedbackEmailNavPaneButton.Visibility = Visibility.Visible; } }
/// <summary> /// Enable or disable the selected items from the navigation ListView /// </summary> /// <param name="collection">Collection of items to update</param> /// <param name="enable">Enable or disable</param> private void EnableNavMenuItem(IEnumerable <NavMenuItem> collection, bool enable) { foreach (NavMenuItem it in collection) { ListViewItem container = (ListViewItem)NavMenuList.ContainerFromItem(it); if (container != null) { container.IsEnabled = enable; } } }
private bool HighlightViewBtn(Guid viewKey) { // Find the button corresponding to the key int i = FindNavListIndexByKey(viewKey); if (i > 0) { return(HighlightNavigationBtn((ListViewItem)NavMenuList.ContainerFromIndex(i))); } else { return(false); } }
/// <summary> /// Gets the container from the given navigation item, either from the main list or the bottom dock. /// </summary> /// <remarks> /// UpdateLayout is invoked to make sure the containers are available even when the ListView was not rendered. /// </remarks> /// <param name="item">The navigation menu item.</param> /// <returns>The list view item container.</returns> private ListViewItem GetContainerFromItem(NavMenuItem item) { NavMenuList.UpdateLayout(); NavMenuList.ScrollIntoView(item); var container = (ListViewItem)NavMenuList.ContainerFromItem(item); if (container == null) { NavMenuListBottomDock.UpdateLayout(); container = (ListViewItem)NavMenuListBottomDock.ContainerFromItem(item); } return(container); }
/// <summary> /// Ensures the nav menu reflects reality when navigation is triggered outside of /// the nav menu buttons. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e) { _appVersion.Text = string.Format("Version: {0}.{1}.{2}.{3}", Windows.ApplicationModel.Package.Current.Id.Version.Major, Windows.ApplicationModel.Package.Current.Id.Version.Minor, Windows.ApplicationModel.Package.Current.Id.Version.Build, Windows.ApplicationModel.Package.Current.Id.Version.Revision); if (e.NavigationMode == NavigationMode.New) { //Updates nav menu if invoked from back/next buttons. { List <NavMenuItem> newList = new List <NavMenuItem> { navlist[0], navlist2[0], //navlist2[1], //navlist2[2], //navlist2[3], navlist3[0] }; var item = (from p in (newList) where p.DestPage == e.SourcePageType select p).SingleOrDefault(); //Set blue tab indicator for selected page //foreach (var i in this.navlist) //{ // i.IsSelected = false; //} //foreach (var i in this.navlist2) //{ // i.IsSelected = false; //} //foreach (var i in this.navlist3) //{ // i.IsSelected = false; //} if (item != null) { item.IsSelected = true; } //Set the selected container. var container = (ListViewItem)NavMenuList.ContainerFromItem(item); Debug.WriteLine("" + container); } } }
/// <summary> /// Highlight a navigation button for a view or page. /// </summary> /// <param name="container"></param> /// <returns>True if the highlight is successful.</returns> private bool HighlightNavigationBtn(ListViewItem container) { // While updating the selection state of the item prevent it from taking keyboard focus. If a // user is invoking the back button via the keyboard causing the selected nav menu item to change // then focus will remain on the back button. if (container != null) { container.IsTabStop = false; NavMenuList.SetSelectedItem(container); container.IsTabStop = true; return(true); } else { return(false); } }
private void SyncMenu() { if (MainFrame == null) { return; } var content = MainFrame.Content as MvxWindowsPage; var index = -1; switch (content.BaseUri.Segments[2]) { case "EventsView.xaml": index = 0; break; case "NotificationsView.xaml": index = 1; break; case "RepositoriesView.xaml": index = 2; break; case "IssuesView.xaml": index = 3; break; case "GistsView.xaml": index = 4; break; } if (!IsFirstTime) { NavMenuList.SelectedIndex = -1; NavMenuList.SetSelectedItem(); } IsFirstTime = false; if (index > -1) { NavMenuList.SelectedIndex = index; NavMenuList.SetSelectedItem(NavMenuList.Items[index] as NavMenuItem); } }
private NavMenuItem SelectNavigationItem(NavMenuItem item) { if (item == null && AppFrame.BackStackDepth > 0) { // in cases where a page drills into sub-pages then we'll highlight the most recent // navigation menu item that appears in the BackStack foreach (var entry in AppFrame.BackStack.Reverse()) { item = GetNavigationItem(entry.SourcePageType); if (item != null) { break; } } } else if (item == null) { var page = AppFrame.Content as UniversalPage; if (page != null) { item = GetNavigationItem(page.ParentPage); } } var container = GetContainerFromItem(item); // while updating the selection state of the item prevent it from taking keyboard focus. If a // user is invoking the back button via the keyboard causing the selected nav menu item to change // then focus will remain on the back button. if (container != null) { container.IsTabStop = false; } NavMenuList.SetSelectedItem(container); NavMenuListBottomDock.SetSelectedItem(container); if (container != null) { container.IsTabStop = true; } return(item); }
private void SelectNavEntryMatching(Type type) { var item = (from p in NavMenuListControls.Items where (p as NavMenuItem).DestPage == type select p).FirstOrDefault(); if (item == null) { item = (from p in NavMenuList.Items where (p as NavMenuItem).DestPage == type select p).FirstOrDefault(); } if (item == null && frame.BackStackDepth > 0) { // In cases where a page drills into sub-pages then we'll highlight the most recent // navigation menu item that appears in the BackStack foreach (var entry in frame.BackStack.Reverse()) { item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).FirstOrDefault(); if (item != null) { break; } } } var NavMenu = NavMenuList; var container = NavMenu.ContainerFromItem(item) as ListViewItem; if (container == null) { NavMenu = NavMenuListControls; container = NavMenu.ContainerFromItem(item) as ListViewItem; } // While updating the selection state of the item prevent it from taking keyboard focus. If a // user is invoking the back button via the keyboard causing the selected nav menu item to change // then focus will remain on the back button. if (container != null) { container.IsTabStop = false; NavMenuList.SetSelectedItem(container); NavMenuListControls.SetSelectedItem(container); container.IsTabStop = true; } }
/// <summary> /// Ensures the nav menu reflects reality when navigation is triggered outside of /// the nav menu buttons. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e) { if (e.NavigationMode == NavigationMode.New) { //Updates nav menu if invoked from back/next buttons. { List <NavMenuItem> newList = new List <NavMenuItem>(); newList.Add(navlist[0]); newList.Add(navlist[1]); newList.Add(navlist[2]); newList.Add(navlist2[0]); newList.Add(navlist2[1]); newList.Add(navlist2[2]); newList.Add(navlist2[3]); newList.Add(navlist3[0]); var item = (from p in (newList) where p.DestPage == e.SourcePageType select p).SingleOrDefault(); //Set blue tab indicator for selected page foreach (var i in this.navlist) { i.IsSelected = false; } foreach (var i in this.navlist2) { i.IsSelected = false; } foreach (var i in this.navlist3) { i.IsSelected = false; } if (item != null) { item.IsSelected = true; } //Set the selected container. var container = (ListViewItem)NavMenuList.ContainerFromItem(item); Debug.WriteLine("" + container); } } }
private void NavMenuList_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Show the back button SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; //Change the title var selectedItem = (sender as NavMenuListView).SelectedValue; PageTitle.Text = (selectedItem as NavMenuItem)?.Label ?? "There should be a title here."; //Deselect the other item if (sender.Equals(NavMenuList)) { NavMenuListBottom.SetSelectedItem(null); } else { NavMenuList.SetSelectedItem(null); } }
private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; NavMenuList.SelectedIndex = 0; NavMenuList.SetSelectedItem(NavMenuList.Items[0] as NavMenuItem); if (!(Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported())) { FeedbackNavPaneButton.Visibility = Visibility.Collapsed; FeedbackEmailNavPaneButton.Visibility = Visibility.Visible; } NavPaneDivider.Visibility = Visibility.Collapsed; //ViewModel handles the navigation to the 0 index on startup so have to manually set this here. if (!CrossSecureStorage.Current.HasKey("OAuthToken")) { await ApiKeysManager.KeyRetriever(); } await ViewModel.LoadFragments(); await RegisterAppForStoreNotifications(); }
/// <summary> /// Ensures the nav menu reflects reality when navigation is triggered outside of /// the nav menu buttons. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e) { //if (e.NavigationMode == NavigationMode.Back) if (e.SourcePageType == typeof(ViewerPage)) { return; } var item = (from p in this.navlist where p.DestPage == e.SourcePageType select p).SingleOrDefault(); //if (item == null && this.AppFrame.BackStackDepth > 0) //{ // // In cases where a page drills into sub-pages then we'll highlight the most recent // // navigation menu item that appears in the BackStack // foreach (var entry in this.AppFrame.BackStack.Reverse()) // { // item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).SingleOrDefault(); // if (item != null) // break; // } //} HighlightNavigationBtn((ListViewItem)NavMenuList.ContainerFromItem(item)); }
public void Navigate(NavigationPage navigationPage, object parameter) { switch (navigationPage) { case NavigationPage.BackupConfirmPage: MainFrame.Navigate(typeof(BackupConfirmPage), parameter); break; case NavigationPage.BackupSecretPhrasePage: MainFrame.Navigate(typeof(BackupSecretPhrasePage), parameter); break; case NavigationPage.ReceiveMoneyPage: NavMenuList.SetSelectedItem((ListViewItem)NavMenuList.ContainerFromIndex(2)); MainFrame.Navigate(typeof(ReceiveMoneyPage), parameter); break; case NavigationPage.SendMoneyPage: NavMenuList.SetSelectedItem((ListViewItem)NavMenuList.ContainerFromIndex(1)); MainFrame.Navigate(typeof(SendMoneyPage), parameter); break; } }