.Net Maui, use gestures on tabbed page

Phunction 226 Reputation points
2024-06-28T23:38:06.1833333+00:00

Hi, I have a tabbed page with 2 tabs, on one tab I have and image that I would like the user to be able to use touch to pinch zoom and pan the image around.

I use this to show the image:

<Grid x:Name="imageView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<GraphicsView x:Name="image" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" />
</Grid>

In code, image.Drawable is set to a class that extends IDrawable

This works fine and the image is displayed.

My issue is, righ now when I try to pan or drag from side to side, the tab page will swtich between tabs.

I tried using the events on the tab page child, the image page, private void OnPinchUpdated and private void OnTouch

but they are not called. Where do I intercept these events so I can pan/zoom the image tab without it just swtiching tabs around?

MainTabPage -> ImageTab and InfoTab, just want to zoom/pan the image on ImageTab.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,117 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,550 questions
{count} votes