Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xamarin.Forms scroll only part of the page

I have a page where I want to have a header always in view at the top and buttons always in view at the bottom. the content in the middle is scrollable.

I thought that this would be easy by doing the following:

StackLayout outer = new StackLayout();

StackLayout inner = new StackLayout();//with all of the content added

ScrollView scroll = new ScrollView();


outer.Children.Add(headerLabel);//non-scrolling

scroll.Content = inner;

outer.Children.Add(scroll);      //scrolling

outer.Children.Add(button);     //non-scrolling

The headerLabel and the button stay on the corrrect position but the content scrolls right up to the top of the page, over the top of the headerLabel (but beneath/under the button at the bottom).

I am positive it was working correctly but I can't remember changing anything.

Has anyone got any ideas on why this would be happening?

like image 304
user1667474 Avatar asked Oct 05 '14 11:10

user1667474


1 Answers

so this fixed it

outer.VerticalOptions = LayoutOptions.End;

and

scroll.IsClippedToBounds=true;
like image 132
user1667474 Avatar answered Nov 15 '22 11:11

user1667474