Set sizes for scroll view

KirillRadchenkoKirillRadchenko RUMember ✭✭
edited September 2015 in Xamarin.Forms

I want to add at main page scrollview (500x800).
But when I add the stackLayout inside scrollview, the width of my scrollview becomes equal width of stackLayout (2500x800).

How can I save sizes of my scrollview?

public class App : Application
    {
        public App ()
        {
            ScrollView scrollView = new ScrollView ();
            scrollView.Orientation = ScrollOrientation.Horizontal;
            scrollView.WidthRequest = 500;
            scrollView.HeightRequest = 800;

            StackLayout sl = new StackLayout ();
            sl.WidthRequest = 2500;
            sl.HeightRequest = 800;
            sl.BackgroundColor = Color.Green;
            scrollView.Content = sl;

            ContentPage contentPage = new ContentPage ();
            contentPage.Content = scrollView;
            MainPage = contentPage;
         }
    }
Tagged:

Answers

Sign In or Register to comment.