0

How do I disable changing the top tab by swiping left or right in a .NET MAUI app using Shell?

I have a CarouselView on a page that is displayed within a top tab, but when doing a normal swiping gesture, it doesn't go to the next item in the CarouselView, but switches the top tab instead. If you want to change the item in the CarouselView, you have to press in place for a moment, and then swipe, but that it extremely unnatural.

I understand that having two containers that support swiping on top of each other is a problem, so I simply want to disable the possibility to change tabs by swiping. The user can just tap the corresponding tab if they want to change it.

It might be an Android only problem, the CarouselView on Windows is buggy anyway and I don't have the hardware required to test the iOS version at the moment.

I found a documentation on how to disable swiping in a tabbed page (https://learn.microsoft.com/en-us/dotnet/maui/android/platform-specifics/tabbedpage-page-swiping?view=net-maui-7.0), but it explicitly says that this approach doesn't work when you use Shell.

Naryoril
  • 401
  • 6
  • 19
  • Although the problem is well described, it's recommended to show your code and explain what you've tried. Questions about specific programming problems that do not have code or debugging details are often difficult to understand and are candidates for closure. – Julian Apr 27 '23 at 17:53
  • @ewerspej The problem is, due to how the whole Shell stuff works, it would require a lot of code distributed among many files to have an example that includes everything necessary to show the issue. And I don't think it's an issue where anyone who doesn't already know the answer (if one exists at all) can deduce it by using the example code and trying stuff. If there is a solution at all, it must be some kind of flag somewhere. This also means that I haven't tried anything yet that I could show (apart from Lewis Herbert's answer that doesn't compile).Should i still add all that code? – Naryoril Apr 28 '23 at 09:56
  • I think that I understand the problem based on your description, others may not. Please read [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) as this will make it easier to help you. Try to break it down to the core of the problem, we don't need to see everything, just the relevant bits. And also maybe demonstrate the problem visually to confirm that it's understood correctly. – Julian Apr 28 '23 at 10:12

0 Answers0