I used to have a scroll viewer for terms and conditions, when the user scrolled to the bottom I made the accept button active so they could only proceed once they scrolled.
I used to catch the scroll to bottom event using this code:
scrollViewerMain.ViewChanged += ScrollViewerMain_ViewChanged;
and
private void ScrollViewerMain_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
{
if (_scrolledToBottomEventHandlerHit)
{
return;
}
var verticalOffsetValue = scrollViewerMain.VerticalOffset;
var maxVerticalOffsetValue = scrollViewerMain.ExtentHeight - scrollViewerMain.ViewportHeight;
if (maxVerticalOffsetValue < 0 || verticalOffsetValue == maxVerticalOffsetValue)
{
_scrolledToBottomEventHandlerHit = true;
// Scrolled to bottom - trigger event
ScrolledToBottom(this, new EventArgs());
}
}
This was working fine, but now the terms and conditions come as html, so I have to use the WebView
control so the formatting is correct. There isn't a ViewChanged
event - so how can I achieve the same result - when the user scrolls to the bottom of the WebView
, the button is enabled?