Inheritance: Windows.UI.Xaml.DependencyObject
Exemplo n.º 1
0
        void SetSelectedMenuItem(MenuItem item)
        {
            if (item == null || !item.IsSelectable)
                return;

            var menuListViews = GetMenuListViews(shellSplitView.Pane);

            foreach (var menuListView in menuListViews)
            {
                foreach (var menuItem in menuListView.Items)
                {
                    var container = menuListView.ContainerFromItem(item);
                    menuListView.SetSelectedItem(container as ListViewItem);
                }
            }
        }
Exemplo n.º 2
0
        void OnNavigatedToPage(object sender, NavigationEventArgs e)
        {
            UpdateMenuItems();

            selectedMenuItem = menuItems.SingleOrDefault(p => p.DestinationPage == e.SourcePageType.FullName &&
                                                              Equals(p.NavigationParameter, e.Parameter));
            var snm = SystemNavigationManager.GetForCurrentView();

            if (selectedMenuItem == null && AppFrame.BackStackDepth > 0)
            {
                foreach (var entry in AppFrame.BackStack.Reverse())
                {
                    selectedMenuItem = menuItems.SingleOrDefault(p => p.DestinationPage == e.SourcePageType.FullName &&
                                                                      Equals(p.NavigationParameter, e.Parameter));

                    if (selectedMenuItem != null)
                        break;
                }
            }

            SetSelectedMenuItem(selectedMenuItem);

            snm.AppViewBackButtonVisibility = AppFrame.CanGoBack ? AppViewBackButtonVisibility.Visible :
                                                                   AppViewBackButtonVisibility.Collapsed;
        }