private void UpdateVisualStateForNavigationViewPositionChange() { var position = Position; var stateName = NavigationViewItemHelper.c_OnLeftNavigation; bool handled = false; switch (position) { case NavigationViewRepeaterPosition.LeftNav: case NavigationViewRepeaterPosition.LeftFooter: if (SharedHelpers.IsRS4OrHigher() && Application.Current.FocusVisualKind == FocusVisualKind.Reveal) { // OnLeftNavigationReveal is introduced in RS6 and only in the V1 style. // Fallback to OnLeftNavigation for other styles. if (VisualStateManager.GoToState(this, NavigationViewItemHelper.c_OnLeftNavigationReveal, false /*useTransitions*/)) { handled = true; } } break; case NavigationViewRepeaterPosition.TopPrimary: case NavigationViewRepeaterPosition.TopFooter: stateName = NavigationViewItemHelper.c_OnTopNavigationPrimary; if (SharedHelpers.IsRS4OrHigher() && Application.Current.FocusVisualKind == FocusVisualKind.Reveal) { // OnTopNavigationPrimaryReveal is introduced in RS6 and only in the V1 style. // Fallback to c_OnTopNavigationPrimary for other styles. if (VisualStateManager.GoToState(this, NavigationViewItemHelper.c_OnTopNavigationPrimaryReveal, false /*useTransitions*/)) { handled = true; } } break; case NavigationViewRepeaterPosition.TopOverflow: stateName = NavigationViewItemHelper.c_OnTopNavigationOverflow; break; } if (!handled) { VisualStateManager.GoToState(this, stateName, false /*useTransitions*/); } }
void UpdateVisualStateForNavigationViewListPositionChange() { var position = Position(); var stateName = NavigationViewItemHelper.c_OnLeftNavigation; bool handled = false; if (position == NavigationViewListPosition.LeftNav) { #if !IS_UNO if (SharedHelpers.IsRS4OrHigher() && Application.Current.FocusVisualKind == FocusVisualKind.Reveal) { // OnLeftNavigationReveal is introduced in RS6. // Will fallback to stateName for the customer who re-template rs5 NavigationViewItem if (VisualStateManager.GoToState(this, NavigationViewItemHelper.c_OnLeftNavigationReveal, false /*useTransitions*/)) { handled = true; } } #endif } else if (position == NavigationViewListPosition.TopPrimary) { #if !IS_UNO if (SharedHelpers.IsRS4OrHigher() && Application.Current.FocusVisualKind == FocusVisualKind.Reveal) { stateName = NavigationViewItemHelper.c_OnTopNavigationPrimaryReveal; } else #endif { stateName = NavigationViewItemHelper.c_OnTopNavigationPrimary; } } else if (position == NavigationViewListPosition.TopOverflow) { stateName = NavigationViewItemHelper.c_OnTopNavigationOverflow; } if (!handled) { VisualStateManager.GoToState(this, stateName, false /*useTransitions*/); } }