I have a horizontal scrollview with a button to scroll it leftwards all the way to the end. OR if it's scrolled all the way to the end already scroll it to the beginning. Hence two questions
You can determine the horizontal and vertical scroll offset using the ScrollX
and ScrollY
properties of your ScrollView. These are bindable, so if you're using MVVM you can map them to properties on your view model.
If you're not using MVVM and want to react to changes in ScrollX
or ScrollY
, add a listener to the ScrollView's Scrolled
event.
To find the total height or width of the content in the ScrollView, use the ContentSize
property. The Content
property will give you the contained View
itself.