Class MvpnWebViewRenderer

Last published : Oct 31, 2026
The MvpnWebViewRenderer.cs file provides the custom implementation for WebViewRenderer to enable micro VPN tunneling for Xamarin WebView.
Sample code to inherit MvpnWebViewRenderer:
[assembly: ExportRenderer(typeof(Xamarin.Forms.WebView), typeof(XamarinWebViewRenderer))]
namespace MvpnTestFormsApp.Droid
{
    public class XamarinWebViewRenderer : MvpnWebViewRenderer
    {
        public XamarinWebViewRenderer(Context context) : base(context)
        {
        }
        public override WebViewClient CreateWebViewClient()
        {
            return new FormsWebViewClient(this);
        }
    }
}
Inheritance
    -> System.Object
        -> MvpnWebViewRenderer
Namespace: Com.Citrix.Mvpn.Api
Assembly: MvpnSdkFormsLibrary.dll
Syntax:
public abstract class MvpnWebViewRenderer : WebViewRenderer

Constructors

MvpnWebViewRenderer(Context)

Declaration:
public MvpnWebViewRenderer(Context context)
Parameters:
Type Name Description
Android.Content.Context context This is the application context.

Methods

CreateWebViewClient()

The CreateWebViewClient() abstract method provides an interface to create a WebView client object that is enabled for micro VPN tunneling for Xamarin WebView.
Sample code for CreateWebViewClient() method is as follows:
public override WebViewClient CreateWebViewClient()
{
    return new FormsWebViewClient(this);
}
Declaration:
public abstract WebViewClient CreateWebViewClient()
Returns:
Type Description
Android.Webkit.WebViewClient Returns WebViewClient object that is modified to tunnel Xamarin WebView.

OnElementChanged(ElementChangedEventArgs<WebView>)

This method is the overridden OnElementChanged() method that internally invokes native micro VPN code to enable a Xamarin WebView for tunneling.
Declaration:
protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
Parameters:
Type Name Description
Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.WebView> e This is the ElementChanged event argument for the Xamarin Forms WebView object.