private object GetPreviousNavigationTarget() { var currentContent = this.Content; if (NavigationTargets == null || NavigationTargets.Contains(currentContent) == false) { return(null); } var index = NavigationTargets.IndexOf(currentContent) - 1; if (index < 0) { index = NavigationTargets.Count - 1; } return(NavigationTargets[index]); }
private void UpdateTouchEventHandler() { this.PreviewMouseLeftButtonDown -= SlideToNavigateFrame_PreviewMouseLeftButtonDown; this.PreviewMouseMove -= SlideToNavigateFrame_PreviewMouseMove; this.PreviewMouseLeftButtonUp -= SlideToNavigateFrame_PreviewMouseLeftButtonUp; this.MouseLeave -= SlideToNavigateFrame_MouseLeave; if (NavigationTargets == null || NavigationTargets.Count == 0 || NavigationTargets.Contains(this.Content) == false) { // 若目前所導覽到的畫面並不存在於 NavigationTargets,則不啟用觸控滑動換頁 return; } this.PreviewMouseLeftButtonDown += SlideToNavigateFrame_PreviewMouseLeftButtonDown; this.PreviewMouseMove += SlideToNavigateFrame_PreviewMouseMove; this.PreviewMouseLeftButtonUp += SlideToNavigateFrame_PreviewMouseLeftButtonUp; this.MouseLeave += SlideToNavigateFrame_MouseLeave; }
private object GetNextNavigationTarget() { var currentContent = this.Content; if (NavigationTargets == null || NavigationTargets.Contains(currentContent) == false) { return(null); } var index = NavigationTargets.IndexOf(currentContent) + 1; if (index >= NavigationTargets.Count) { index = 0; } return(NavigationTargets[index]); }