Dear all,
I have within a ScrolViewer a stack panel with two user control, each user control displays in full screen resolution.
When I touch the first control and slide it up then it display the second one. So far so good.
What I am looking for to accomplish is that if the user start to slide up the scroll viewer and then release his finger, I would like to control the scroll viewer translation up. IN similar way as the new start screen of Windows 8.1.
For that I have use the scrllchange event and run following code in it :
private void _mainVScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { //if (e.VerticalOffset > OffSetToScroll & !IsScrolling) //{ CurScrollToPos = e.VerticalOffset; _mainVScrollViewer.ScrollChanged -= new ScrollChangedEventHandler(_mainVScrollViewer_ScrollChanged); DoubleAnimation da; da = new DoubleAnimation(CurScrollToPos, (_appLayoutPanel.ActualHeight / _appLayoutPanel.Children.Count * (_appLayoutPanel.Children.Count - 1)), new Duration(TimeSpan.FromSeconds(2))); Console.WriteLine(da.From.ToString()); Console.WriteLine(da.To.ToString()); CubicEase be = new CubicEase(); be.EasingMode = EasingMode.EaseInOut; da.EasingFunction = be; IsScrolling = true; da.Completed += new EventHandler(da_Completed); this.BeginAnimation(VOffsetProperty, da); //} }
running this is doing weird things because f I release touch the event is still called and then weird animation occurs.
Any tips?
regards