private void RevertSelection(NavMenuListView view, NavigatingCancelEventArgs e) { var item = (from p in wholeList 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 wholeList where p.DestPage == entry.SourcePageType select p).SingleOrDefault(); if (item != null) { break; } } } var container = (ListViewItem)view.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; } view.SetSelectedItem(container); if (container != null) { container.IsTabStop = true; } }
private void UpdateSelection(NavMenuListView view, Page page) { var item = (from p in wholeList where p.DestPage == page.GetType() select p).SingleOrDefault(); var container = (ListViewItem)view.ContainerFromItem(item); if (container == null) { DebugUtil.Log(() => "Nothing selected"); } if (container != null) { container.IsTabStop = false; } view.SetSelectedItem(container); if (container != null) { container.IsTabStop = true; } }