ScrollView issues


I've been searching for a while and have been unable to find any decent examples of a similar scenario to what I am facing. I have found tutorials for how to do this in Xcode, but cannot find anything for Xamarin/Visual Studio.

Now, I am attempting to try and do this through the Storyboard as I find it a bit quicker to get the positioning of UILabels/UITextFields but I am open to doing this in code if necessary.

I have tried a few things, however have not been able to get this to scroll. Here's a few of the things I've tried:

  1. Added ScrollView via StoryBoard. Stretched it out to take up about 80% of the height of the screen. I then added as many views to the screen as I could fit. Before being able to work out how to stretch the scrollview in storyboard mode, I then tried to append a couple more views via code. I can see them being cut off (so the content is definitely overflowing), yet it wouldn't let me scroll.

  2. Next I emptied the ScrollView and added all the elements via code. Again, I can see them getting cut-off and overflowing the designated scrollview, yet I still cannot scroll.

  3. Finally worked out how to make the ViewController Size "freeform" in Visual Studio (could not find information anywhere on how to set this). I stretched the scrollview out way past the viewcontroller, and added a couple of dummy labels at the top, middle, and bottom positions. When loading up my simulator I could only see the first two (the third was out of reach of screen), and I still could not scroll.

  4. Further to #3, I tried adding a UIVIew on top of the scrollview, stretched it out further than the scrollview, and added a label to the bottom of it. This didn't work.

Have been trying to resolve this for a couple of days now and have had no luck.

The only Xamarin example I could find for ScrollView ( is extremely basic and does not go in to much detail at all.

Please, could someone help me understand what I am doing wrong?

Best Answer


  • adamkempadamkemp USInsider, Developer Group Leader mod

    The placement of items in a scroll view doesn't in any way affect how or whether it scrolls. You need to set the scroll view's ContentSize to the size of the scrollable content. If that size is bigger than the scroll view's bounds then it will allow you to scroll. If not then it won't. The default content size is 0 so unless you set it to something it won't scroll ever.

  • NormanBardellNormanBardell AUMember ✭✭

    Gotcha, thanks.

    Wouldn't it make sense that the content size should be inferred by the content in which it contains?

Sign In or Register to comment.