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

Set sizes for scroll view

$
0
0

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;
         }
    }

Viewing all articles
Browse latest Browse all 75885

Trending Articles