protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // Parameter is item ID Item = AnimalsDataSource.GetItemById((int)e.Parameter); var backStack = Frame.BackStack; var backStackCount = backStack.Count; if (backStackCount > 0) { var masterPageEntry = backStack[backStackCount - 1]; backStack.RemoveAt(backStackCount - 1); // Doctor the navigation parameter for the master page so it // will show the correct item in the side-by-side view. var modifiedEntry = new PageStackEntry( masterPageEntry.SourcePageType, Item.Id, masterPageEntry.NavigationTransitionInfo ); backStack.Add(modifiedEntry); } // Register for hardware and software back request from the system SystemNavigationManager.GetForCurrentView().BackRequested += DetailPage_BackRequested; }
private void MasterListView_ItemClick(object sender, ItemClickEventArgs e) { var clickedItem = (Animal)e.ClickedItem; _lastSelectedItem = clickedItem; if (AdaptiveStates.CurrentState == NarrowState) { // Use "drill in" transition for navigating from master list to detail view Frame.Navigate(typeof(DetailPage), clickedItem.Id, new DrillInNavigationTransitionInfo()); } else { // Play a refresh animation when the user switches detail items. EnableContentTransitions(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var items = MasterListView.ItemsSource as List<Animal>; if (e.Parameter != null && e.Parameter is int) { // Parameter is item ID var id = (int)e.Parameter; _lastSelectedItem = items.Where((item) => item.Id == id).FirstOrDefault(); } UpdateForVisualState(AdaptiveStates.CurrentState); // Don't play a content transition for first item load. // Sometimes, this content will be animated as part of the page transition. DisableContentTransitions(); }