private async void OnCurrentCatalogContentChanged(string str) { IsLoadingContent = true; var windowHeight = Window.Current.Bounds.Height; ContentText.Height = double.NaN; Viewer.ChangeView(0, 0, null, true); await Task.Delay(5); var textHeight = ContentText.ActualHeight; if (textHeight < windowHeight + 200) { ContentText.Height = windowHeight + 200; await Task.Delay(2); } else { ContentText.Height = textHeight; } Viewer.ChangeView(0, 50, null, Viewer.VerticalOffset > 50); IsLoadingContent = false; }
private void ZoomOutButton_Click(object sender, RoutedEventArgs e) { int Mod = ZoomFactor % 10; int NextFactor = ZoomFactor - (Mod > 0 ? Mod : 10); if (NextFactor >= 50) { ZoomFactor = NextFactor; ZoomFactorDisplay.Text = $"{NextFactor}%"; if (Flip.ContainerFromIndex(Flip.SelectedIndex).FindChildOfName <ScrollViewer>("ScrollViewerMain") is ScrollViewer Viewer) { Viewer.ChangeView(null, null, NextFactor / 100f); } } }
private void Flip_SelectionChanged_TaskOne(object sender, SelectionChangedEventArgs e) { TextBoxControl.Text = Convert.ToString(Flip.SelectedIndex + 1); if (!PanelToggle.IsChecked.GetValueOrDefault()) { if (Flip.ContainerFromIndex(Flip.SelectedIndex).FindChildOfName <ScrollViewer>("ScrollViewerMain") is ScrollViewer Viewer) { if (PdfCollection.IndexOf(e.AddedItems.Cast <BitmapImage>().FirstOrDefault()) > PdfCollection.IndexOf(e.RemovedItems.Cast <BitmapImage>().FirstOrDefault())) { Viewer.ChangeView(0, 0, ZoomFactor / 100f, true); } else { Viewer.ChangeView(0, Viewer.ScrollableHeight, ZoomFactor / 100f, true); } } } }
private void ScrollViewerMain_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { if (e.PointerDeviceType != PointerDeviceType.Touch) { if (sender is ScrollViewer Viewer) { Point TapPoint = e.GetPosition(Viewer); if (Math.Abs(Viewer.ZoomFactor - 1f) <= 1E-6) { ZoomFactor = 200; Viewer.ChangeView(TapPoint.X, TapPoint.Y, 2f); } else { ZoomFactor = 100; Viewer.ChangeView(null, null, 1f); } } } }