Class MvpnWebViewRenderer
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);
}
}
}
<!--NeedCopy-->
Inheritance
-> System.Object
-> MvpnWebViewRenderer
Namespace: Com.Citrix.Mvpn.Api
Assembly: MvpnSdkFormsLibrary.dll
Syntax:
public abstract class MvpnWebViewRenderer : WebViewRenderer
<!--NeedCopy-->
Constructors
MvpnWebViewRenderer(Context)
Declaration:
public MvpnWebViewRenderer(Context context)
<!--NeedCopy-->
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);
}
<!--NeedCopy-->
Declaration:
public abstract WebViewClient CreateWebViewClient()
<!--NeedCopy-->
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)
<!--NeedCopy-->
Parameters:
Type | Name | Description |
---|---|---|
Xamarin.Forms.Platform.Android.ElementChangedEventArgs |
e | This is the ElementChanged event argument for the Xamarin Forms WebView object. |