Xamarin.Forms Guides | Samples

Xamarin.Forms.ScrollView Class

An element capable of scrolling if its Content requires.

See Also: ScrollView


public class ScrollView : Layout, IElementConfiguration<ScrollView>, IScrollViewController


The following example shows the creation of a ScrollView with a large StackLayout in it.

C# Example

var stack = new StackLayout();

for (int i = 0; i < 100; i++)
    stack.Children.Add(new Button { Text = "Button " + i });

MainPage = new ContentPage
    Content = new ScrollView { Content = stack }
Note: Application developers should not nest one ScrollView within another. Additionally, they should refrain from nesting them other elements that can scroll, such as WebView.

XAML for Xamarin.Forms supports the following properties for the ScrollView class:


Markup that specifies a View to display in the ScrollView.


Horizontal or Vertical, to indicate the scroll direction.


Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions:,,,,,,,

The members of Xamarin.Forms.ScrollView are listed below.

See Also: Layout

Public Constructors

Initializes a new instance of the ScrollView class.

Public Fields

static readonly
ContentSizePropertyBindableProperty. Identifies the ContentSize bindable property.
static readonly
OrientationPropertyBindableProperty. Identifies the Orientation bindable property.
static readonly
ScrollXPropertyBindableProperty. Backing store for the ScrollView.ScrollX property.
static readonly
ScrollYPropertyBindableProperty. Backing store for the ScrollView.ScrollY property.

Public Properties

ContentView. Gets or sets a View to display in the ScrollView.
ContentSizeSize. Gets the size of the Content. This is a bindable property.
OrientationScrollOrientation. Gets or sets the scrolling direction of the ScrollView. This is a bindable property.
ScrollXDouble. Gets the current X scroll position.
ScrollYDouble. Gets the current Y scroll position..

Public Methods

On<T>() : IPlatformElementConfiguration<T, ScrollView>
Returns the platform-specific instance of this ScrollView, on which a platform-specific method may be called.
ScrollToAsync(Double, Double, Boolean) : Task
Returns a task that scrolls the scroll view to a position asynchronously.
ScrollToAsync(Element, ScrollToPosition, Boolean) : Task
Returns a task that scrolls the scroll view to an element asynchronously.

Protected Methods

LayoutChildren(Double, Double, Double, Double)
Positions and sizes the content of a ScrollView.
OnSizeRequest(Double, Double) : SizeRequest
This method is called during the measure pass of a layout cycle to get the desired size of an element.

Public Events

ScrolledEvent that is raised after a scroll completes.

Explicitly Implemented Interface Members