using System.Windows; using System.Windows.Controls; namespace Dominion.NET_WPF.Controls { /// /// Interaction logic for ucKineticScroller.xaml /// public partial class ucKineticScroller : UserControl { public ucKineticScroller() { InitializeComponent(); } private void svScroller_ScrollChanged(object sender, ScrollChangedEventArgs e) { var sv = sender as ScrollViewer; if (sv == null) return; bItemsHorizontal.Width = sv.ViewportWidth * sv.ViewportWidth / sv.ExtentWidth; bItemsVertical.Height = sv.ViewportHeight * sv.ViewportHeight / sv.ExtentHeight; bItemsHorizontal.Margin = new Thickness(sv.ViewportWidth * sv.HorizontalOffset / sv.ExtentWidth, 0, 0, 0); bItemsVertical.Margin = new Thickness(0, sv.ViewportHeight * sv.VerticalOffset / sv.ExtentHeight, 0, 0); } } }