nokola
Topic Author
Posts: 119
Joined: 10 Mar 2015, 05:29

Best way to implement rubberband (bounce) scrollviewer effect?

22 Nov 2017, 10:21

Trying to implement a scroll effect like this (WP): https://www.youtube.com/watch?v=ymtCIwi42Zk
Once you scroll to the top, and keep dragging, the ScrollViewer scales to be "squished" and snaps back once you release your finger.
iOS has similar behavior, except for no squishing.

What is the best way to implement this?
1. Subscribe to "scrollchanged" handler, then check touch position and "squish" with ScaleTransform until finger lifted?
OR
2. Inherit from ScrollViewer and do something else?
OR
3. Wait for native support in Noesis? (if planned)

Thanks!
Edit: found this source that has a nice algorithm for spring scroll (for XNA) https://github.com/DigitalRune/DigitalR ... r.cs#L1029
 
User avatar
jsantos
Site Admin
Posts: 1872
Joined: 20 Jan 2012, 17:18
Contact:

Re: Best way to implement rubberband (bounce) scrollviewer effect?

23 Nov 2017, 12:11

1) seems to be the best option to me.

Regarding 3) we have plans to implement ReportBoundaryFeedback. With that event everything would be easier for you I assume.
 
nokola
Topic Author
Posts: 119
Joined: 10 Mar 2015, 05:29

Re: Best way to implement rubberband (bounce) scrollviewer effect?

23 Nov 2017, 19:51

Good to know, thanks! I'll try #1for now (with global event handler and VisualTreeHelper.HitTest(..) similar to how I did the TiltEffect) and eventually move to #3.

Who is online

Users browsing this forum: No registered users and 3 guests