user3506776
user3506776

Reputation: 103

ScrollOrientation.Both on Xamarin Forms ScrollView

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.

Upvotes: 3

Views: 4864

Answers (3)

bashahul
bashahul

Reputation: 422

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">

Upvotes: 4

user2986451
user2986451

Reputation: 41

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;

Upvotes: 3

Stephane Delcroix
Stephane Delcroix

Reputation: 16232

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

Upvotes: 0

Related Questions