/// <summary> /// Событие на отпускание мышки на Stack Panel /// </summary> /// <param name="sender">StackPanel</param> /// <param name="e">MouseButtonEventArgs</param> private void StackPanelMouseUp(object sender, MouseButtonEventArgs e) { if (e.ChangedButton != MouseButton.Left) { return; } if (!_keyDown) { return; } _keyDown = false; if (ScrollViewer1.ScrollableWidth - _size.Width / 2 >= ScrollViewer1.HorizontalOffset && _size.Width / 2 <= ScrollViewer1.HorizontalOffset) { ScrollViewer1.ScrollToHorizontalOffset(_size.Width); return; } if (_size.Width / 2 > ScrollViewer1.HorizontalOffset) { ScrollViewer1.ScrollToHorizontalOffset(0); AddAndRemoveImage(ScrollViewer1); } else { ScrollViewer1.ScrollToHorizontalOffset(ScrollViewer1.ScrollableWidth); AddAndRemoveImage(ScrollViewer1); } }
private void sv2_ScrollChanged(object sender, ScrollChangedEventArgs e) { ScrollViewer sv = e.OriginalSource as ScrollViewer; if (sv != null) { ScrollViewer1.ScrollToHorizontalOffset(sv.HorizontalOffset); ScrollViewer3.ScrollToVerticalOffset(sv.VerticalOffset); } }
private void ScrollChanged(object sender, ScrollChangedEventArgs e) { ScrollViewer1.ScrollToHorizontalOffset(e.HorizontalOffset); }