private void DetailImageZoomScrollViewer_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { Point p = e.GetPosition(DetailImageZoomScrollViewer); TimeSpan period = TimeSpan.FromMilliseconds(10); Windows.System.Threading.ThreadPoolTimer.CreateTimer(async(source) => { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (DetailImageZoomScrollViewer.ZoomFactor <= 1) { var k = DetailImageZoomScrollViewer.ChangeView(p.X + DetailImageZoomScrollViewer.HorizontalOffset * 2, p.Y + DetailImageZoomScrollViewer.VerticalOffset * 2, 2); } else { DetailImageZoomScrollViewer.ChangeView(DetailImageZoomScrollViewer.HorizontalOffset / 2 - p.X, DetailImageZoomScrollViewer.VerticalOffset / 2 - p.Y, 1); } }); } , period); }
private void ZoomClose(object sender, RoutedEventArgs e) { DetailImageZoomGrid.Visibility = Visibility.Collapsed; DetailImageZoom.Source = null; DetailImageZoomScrollViewer.ChangeView(null, null, 1); }