question

freudifreudi-5539 avatar image
0 Votes"
freudifreudi-5539 asked JarvanZhang-MSFT commented

Swipe Gesture for whole screen Xamarin Forms

I have a contentpage with some controls (buttons/stacks/labels etc.) on it and want to have only a global up/down swipe gesture. I tried a lot of things but looks like I have to add the SwipeGestureRecognizer to all views on the page, isn't there another way?

dotnet-xamarinforms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
0 Votes"
JarvanZhang-MSFT answered JarvanZhang-MSFT commented

Hello @freudifreudi-5539 ,​

Welcome to our Microsoft Q&A platform!

I tried a lot of things but looks like I have to add the SwipeGestureRecognizer to all views on the page, isn't there another way

To add swipe gesture for the whole screen, you could just add the gesture for the root layout of the page like below:

<ContentPage.Content>
    <StackLayout >
        <StackLayout.GestureRecognizers>
            <SwipeGestureRecognizer Swiped="SwipeGestureRecognizer_Swiped" Direction="Up,Down"/>
        </StackLayout.GestureRecognizers>

        <!--the content-->
    </StackLayout>
</ContentPage.Content>


Best Regards,

Jarvan Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, @freudifreudi-5539
May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·