■ WebView 엘리먼트의 On<T> 메소드를 사용해 확대/축소하는 방법을 보여준다.
▶ MainPage.xaml
1 2 3 4 5 6 7 8 9 |
<?xml version="1.0" encoding="utf-8" ?> <ContentPage x:Class="TestProject.MainPage" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> <WebView x:Name="webView" Source="https://docs.microsoft.com/dotnet/maui" /> </ContentPage> |
▶ MainPage.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; namespace TestProject; /// <summary> /// 메인 페이지 /// </summary> public partial class MainPage : ContentPage { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainPage() /// <summary> /// 생성자 /// </summary> public MainPage() { InitializeComponent(); var configuration = this.webView.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>(); configuration.EnableZoomControls(true); configuration.DisplayZoomControls(true); } #endregion } |