How to Enable Zoom Feature for BlazorWebView MAUI Hybrid on Android?

Thinh Do 0 Reputation points
2024-12-07T17:00:11.6933333+00:00

Hello,

I am working on a project using .NET MAUI with Blazor Hybrid. I want to enable the zoom feature (pinch-to-zoom and double-tap-to-zoom) for the BlazorWebView when running on an Android device.

Currently, the content in the BlazorWebView is not zoomable. I would like to know if there is a built-in way to enable this or if I need to implement it through custom renderers or platform-specific code.

Any guidance, sample code, or reference to documentation would be greatly appreciated.

Thank you!

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,768 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 68,716 Reputation points
    2024-12-07T19:23:51.27+00:00

    You would use jsinterop to capture the pinch events, and set the body zoom via css.

    https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events/Pinch_zoom_gestures

    0 comments No comments

Your answer

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