Hello,
I've tested your code on my side, and it worked fine.
You could try the following steps:
Step1: Change
Step1: Please uncomment your GestureRecognizers
.
Step2: On my side, I used DisplayAlert("Test","Swiped","OK")
in SwipeGestureRecognizer_Swiped
for testing.
In addition, if you used the following code, you will find case SwipeDirection.Up & Down
will never be called.
switch (e.Direction)
{
case SwipeDirection.Left:
// Handle the swipe
break;
case SwipeDirection.Right:
// Handle the swipe
break;
case SwipeDirection.Up:
// Handle the swipe
break;
case SwipeDirection.Down:
// Handle the swipe
break;
}
It is caused by the ScrollView
, you could change it to VerticalStackLayout
.
You need to use Custom Renderer
to deal with up down scrolling.
You could refer to this thread on StackOverflow: Xamarin.Forms. SwipeGesture and ScrollView don't work together on Android - Stack Overflow.
In MAUI, we could use the custom renderer by the following way:
builder
.UseMauiCompatibility()
.ConfigureMauiHandlers((handlers) => {
#if ANDROID
handlers.AddHandler(typeof(Shell), typeof(ShellTitle.Platforms.Android.MyRenderer));
#endif
#if IOS
handlers.AddHandler(typeof(Shell), typeof(ShellTitle.Platforms.iOS.MyRenderer));
#endif
})
You could refer to Using Custom Renderers in .NET MAUI to get more details.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.
I've updated my answer, could you please check it?
Hi Alec Liu
Please
If I want to change my UI to Tabbed UI
Do I will have one place for my all code.
or must code per Tabbed page.
And then use standard maui gestures .
Thank you very much.
Hi Alec Liu.
I browsed this site and found something
about texbox editor with scrollbars.
this can solve my swipe problem
because I want my maui editor to be
with scrollbars.
so please how can achieve maui editor with
scrollbars.
thank you very much
Sign in to comment