.Net Maui, use gestures on tabbed page

Phunction 301 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.

Developer technologies | .NET | .NET MAUI
Developer technologies | C#
Developer technologies | 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.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.