Forum Discussion

Doug Harber's avatar
Doug Harber
Copper Contributor
Nov 29, 2021

MAUI ScrollGestureRecognizer doesn't seem to fire

I've got some XAML in a MAUI app that looks roughly like this:

 

 

<Grid>
  <Grid.GestureRecognizers>
    <SwipeGestureRecognizer Direction="Left,Right" Swiped="MainPage_Swiped"/>
  </Grid.GestureRecognizers>

  <ScrollView ...>
    <VerticalStackLayout .../>
  </ScrollView>
</Grid>

 

 

The content (a collection of images) is loaded in the VerticalStackLayout and scrolls vertically in the ScrollView just fine. But the left and/or right gesture swipes from the gesture recognizers never fire an event when I try to swipe on the display.

 

I also tried moving the gesture recognizer down the ScrollView element and even to the VerticalStackLayout element in case it was some kind of event propagation issue, but nothing has worked.

 

There is very little documentation discussing how any of these things work (that's sort of a lie; as far as I can tell there is no documentation on it) and even the Xamarin docs were unrevealing.

 

Is there some documentation about how the gesture recognizers work and interact with other elements that might have some sort of gesture recognition already? Alternately, can anyone suggest a way to make this work?

 

This is on Android, by the way, since I don't have any Apple products on which to develop and I can't get MAUI to run successfully on Windows.

 

Thanks for any help or info!

  • Praxiteles's avatar
    Praxiteles
    Copper Contributor

    Doug Harber Did you find a work-around for this. I'm hitting the same issue. It seems that if you register for right and left gestures only, the up and down gestures don't go to the scrollview any more.

Resources