public FullPlayerPage() { InitializeComponent(); NavigationCacheMode = NavigationCacheMode.Enabled; ViewModel = new FullPlayerPageViewModel(); NavigationView.Events().SelectionChanged .Where(x => x.args.IsSettingsSelected == false) .Select(x => x.args) .Where(x => x.SelectedItem is NavigationViewItemViewModel) .ObserveOnDispatcher() .Subscribe(x => { var opt = new FrameNavigationOptions() { TransitionInfoOverride = x.RecommendedNavigationTransitionInfo }; NavigationContentFrame.NavigateToType(((NavigationViewItemViewModel)x.SelectedItem).PageType, null, opt); }); this.WhenActivated(d => { this.OneWayBind(ViewModel, vm => vm.Navigations, v => v.NavigationView.MenuItemsSource) .DisposeWith(d); NavigationView.SelectedItem = ViewModel.Navigations[0]; }); }
public SettingsPage() { InitializeComponent(); NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required; ViewModel = new SettingsPageViewModel(); NavigationView.Events().SelectionChanged .Where(x => x.args.IsSettingsSelected == false) .Select(x => x.args) .Where(x => x.SelectedItem is NavigationViewItemViewModel) .ObserveOnDispatcher() .Subscribe(x => { var opt = new FrameNavigationOptions() { TransitionInfoOverride = x.RecommendedNavigationTransitionInfo }; NavigationContentFrame.NavigateToType(((NavigationViewItemViewModel)x.SelectedItem).PageType, null, opt); }); NavigationView.SelectedItem = ViewModel.Navigations[0]; }