public void ScrollToBottom() { if (ScrollingHost != null) { ScrollingHost.ChangeView(null, ScrollingHost.ScrollableHeight, null); } }
private void SharedMedia_ViewChanged(object sender, ScrollViewerViewChangedEventArgs args) { var scrollViewer2 = SharedMedia.GetScrollViewer(); if (_sharedMediaDisabled) { if (!args.IsIntermediate) { scrollViewer2.ChangeView(null, 12, null, false); } _sharedMedia = scrollViewer2.VerticalOffset; return; } if (scrollViewer2.VerticalOffset <= 12 && _sharedMedia > scrollViewer2.VerticalOffset) { ScrollingHost.VerticalScrollMode = ScrollMode.Auto; ScrollingHost.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; ScrollingHost.ChangeView(null, ScrollingHost.ScrollableHeight - 48, null, false); _scrollingHostDisabled = false; _sharedMediaDisabled = true; SharedMedia.SetScrollMode(false); } _sharedMedia = scrollViewer2.VerticalOffset; }
private void ScrollingHost_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e) { // We want to update containers when the view has been scrolled to the start/end or when the change has ended if (ScrollingHost.HorizontalOffset == 0 || ScrollingHost.HorizontalOffset == ScrollingHost.ScrollableWidth || (_needFinal && !e.IsIntermediate)) { _needFinal = false; var viewModel = ViewModel; if (viewModel == null) { // Page is most likey being closed, just reset the view LayoutRoot_HorizontalSnapPointsChanged(LayoutRoot, null); return; } var selected = viewModel.SelectedIndex; var previous = selected > 0; var next = selected < viewModel.Items.Count - 1; #if GALLERY_EXPERIMENTAL var difference = previous ? 0 : LayoutRoot.SnapPointWidth; #else var difference = 0; #endif var index = Math.Round((difference + ScrollingHost.HorizontalOffset) / LayoutRoot.SnapPointWidth); if (index == 0 && previous) { viewModel.SelectedItem = viewModel.Items[selected - 1]; PrepareNext(-1); Dispose(); } else if (index == 2 && next) { viewModel.SelectedItem = viewModel.Items[selected + 1]; PrepareNext(+1); Dispose(); } viewModel.LoadMore(); #if GALLERY_EXPERIMENTAL if (ViewModel.SelectedIndex == 0 || !previous) { //ScrollingHost.ChangeView(index == 2 ? LayoutRoot.SnapPointWidth : 0, null, null, true); ScrollingHost.ChangeView(0, null, null, true); } else #endif { ScrollingHost.HorizontalSnapPointsType = SnapPointsType.None; ScrollingHost.ChangeView(LayoutRoot.SnapPointWidth, null, null, true); ScrollingHost.HorizontalSnapPointsType = SnapPointsType.MandatorySingle; } } else { _needFinal = true; } }
public void UpdateItem(IGalleryDelegate delegato, GalleryContent item) { _delegate = delegato; _item = item; Tag = item; Panel.Background = null; Texture.Source = null; ScrollingHost.ChangeView(0, 0, 1, true); if (item == null) { return; } var data = item.GetFile(); var thumb = item.GetThumbnail(); Panel.Constraint = item.Constraint; Panel.InvalidateMeasure(); if (thumb != null && (item.IsVideo || (item.IsPhoto && !data.Local.IsDownloadingCompleted))) { UpdateThumbnail(item, thumb); } UpdateFile(item, data); }
public void UpdateItem(IGalleryDelegate delegato, GalleryContent item) { _delegate = delegato; _item = item; Tag = item; Panel.Background = null; Texture.Source = null; ScrollingHost.ChangeView(0, 0, 1, true); if (item == null) { return; } var file = item.GetFile(); var thumbnail = item.GetThumbnail(); Panel.Constraint = item.Constraint; Panel.InvalidateMeasure(); UpdateManager.Subscribe(this, delegato.ProtoService, file, ref _fileToken, UpdateFile); UpdateFile(item, file); if (thumbnail != null && (item.IsVideo || (item.IsPhoto && !file.Local.IsFileExisting()))) { UpdateThumbnail(item, thumbnail, true); } }
public void Zoom(bool zoomIn) { var factor = ScrollingHost.ZoomFactor + (zoomIn ? 0.25f : -0.25f); if (factor <= ScrollingHost.MaxZoomFactor) { var horizontal = Panel.ActualWidth * factor - ScrollingHost.ActualWidth; var vertical = Panel.ActualHeight * factor - ScrollingHost.ActualHeight; if (ScrollingHost.ScrollableWidth > 0) { horizontal *= ScrollingHost.HorizontalOffset / ScrollingHost.ScrollableWidth; } else { horizontal /= 2; } if (ScrollingHost.ScrollableHeight > 0) { vertical *= ScrollingHost.VerticalOffset / ScrollingHost.ScrollableHeight; } else { vertical /= 2; } ScrollingHost.ChangeView(horizontal, vertical, factor); } }
private void ScrollingHost_PointerMoved(object sender, PointerRoutedEventArgs e) { if (_pointerPressed) { var point = e.GetCurrentPoint(ScrollingHost); var diffX = _pointerPosition.X - point.Position.X; var diffY = _pointerPosition.Y - point.Position.Y; ScrollingHost.ChangeView(diffX, diffY, null, true); } }
private async void PanelDoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { var position = e.GetPosition(Panel); if (ScrollingHost.ZoomFactor != 1) { ScrollingHost.ChangeView(null, null, 1, true); } else if (ScrollingHost.ZoomFactor == 1) { var dispatcher = Window.Current.CoreWindow.Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.High, () => { ScrollingHost.ChangeView(position.X, position.Y, 4, true); }); } }
public void OnBackRequested(HandledRoutedEventArgs args) { if (_scrollingHostDisabled) { _scrollingHostDisabled = false; SharedMedia.SetScrollMode(false); //SetScrollMode(true); ScrollingHost.VerticalScrollMode = ScrollMode.Auto; ScrollingHost.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; ScrollingHost.ChangeView(null, 0, null, false); ScrollingInfo.Visibility = Visibility.Visible; InfoPanel.Visibility = Visibility.Collapsed; args.Handled = true; } }
private void SetScrollMode(bool enable) { if (enable) { ScrollingHost.VerticalScrollMode = ScrollMode.Auto; ScrollingHost.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; ScrollingHost.ChangeView(null, ScrollingHost.ScrollableHeight - 48, null, false); ScrollingInfo.Visibility = Visibility.Visible; InfoPanel.Visibility = Visibility.Collapsed; } else { ScrollingHost.ChangeView(null, ScrollingHost.ScrollableHeight, null, true); ScrollingHost.VerticalScrollMode = ScrollMode.Disabled; ScrollingHost.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; ScrollingInfo.Visibility = Visibility.Collapsed; InfoPanel.Visibility = Visibility.Visible; } }
private void TagsTextBox_SizeChanged(object sender, SizeChangedEventArgs e) { ScrollingHost.ChangeView(null, ScrollingHost.ScrollableHeight, null); }
private void ChangeView(int index, bool disableAnimation) { ScrollingHost.ChangeView(ActualWidth * index, null, null, disableAnimation); }
private void LayoutRoot_HorizontalSnapPointsChanged(object sender, object e) { ScrollingHost.HorizontalSnapPointsType = SnapPointsType.None; ScrollingHost.ChangeView(LayoutRoot.SnapPointWidth, null, null, true); ScrollingHost.HorizontalSnapPointsType = SnapPointsType.MandatorySingle; }
public void Reset() { ScrollingHost.ChangeView(0, 0, 1, true); }