3

Does anyone have any suggestions to allow a ScrollView to allow scrolling in any direction.

There seems to be only Horizontal & Vertical ScrollOrientation but no option to do both at the same time.

My end goal is to be able to pinch, zoom & scroll any direction.

3 Answers 3

4

Xamarin Forms scrollview's Orientation property now accepts Both as a value. It scrolls on both direction. I am using Xamarin Forms version 2.3.0.49.

<ScrollView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Orientation="Both">

Sign up to request clarification or add additional context in comments.

1 Comment

This doesn't work for me. It results in a runtime exception. Xamarin Forms version 2.3.3.180.
3

Here's how you do it.

var scroller = new ScrollView { Content = grid, Orientation= ScrollOrientation.Horizontal, VerticalOptions=LayoutOptions.FillAndExpand };
var vScroller = new ScrollView (){Content=scroller};
Content = vScroller;

1 Comment

It does work, but it does not allow for scrolling diagonally.
0

ScrollOrientation is not a [Flags] enum and does not contains Both value, so this i snot supported at this time. But this could work:

new ScrollView {
    Orientation = ScrollOrientation.Vertical,
    Content = new ScrollView {
        Orientation = ScrollOrientation.Horizontal,
        Content = your_content_goes_here,
    }
}

2 Comments

It's basically the same code like from user2986451, which does work for me. What is your Content? I'm using a Label in a StackLayout in the inner horizontal scroll view. What doesn't work? Only one scrolling direction?
the documentation says not to put a scrollview in a scrollview learn.microsoft.com/en-us/dotnet/api/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.