Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Custom Control based on ScrollView - exception in Android, while iOS/WP work great

$
0
0

Deriving from ScrollView and a renderer from ScrollViewRenderer.

In the OnElementChanged I am trying to get to the HorizontalScrollView using the following:

            _scrollView = (HorizontalScrollView)typeof(ScrollViewRenderer)
                .GetField ("hScrollView", BindingFlags.NonPublic | BindingFlags.Instance)
                .GetValue (this);

But it is always null. So I tried, from checking forums/etc:

var horizontal = this.ViewGroup.GetChildAt(0) as ViewGroup;
if (horizontal is HorizontalScrollView)
{
.....

What am I missing on Android w/r to the ScrollView? I've seen a working example of the first approach working just not sure what I am missing.

Thanks!


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>