0
votes

I am trying to create a custom control for webview, i am trying to get a checkbox inside a webview Reason :- we have a bunch of text to be displayed and unless the user reaches the end of the scroll he cannot move to the next page and at the end of the scroll there is a checkbox where user has to check the the checkbox and then he can process. here i have tried putting the checkbox and webview inside the stacklayout but the issue is webview have its own scroll bar and and stacklayout scroll bar does not work when a user try to scroll as the webview scroller scrolls out also when i try to close the Webview Page with back button the webview gets close and not the page

i am not sure what approach should i apply here.

i am getting my html data from my webapi.

anyone with some solution would be appreciable

here is my custom renderer which i have wrote but the piece missing here is how can i add another xamarin control inside this

public class CustomPdfViewRenderer : WebViewRenderer
{

    public CustomPdfViewRenderer(Context context) : base(context)
    {

    }

    protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
    {
        base.OnElementChanged(e);
        if (Control != null)
        {
            Control.Settings.BuiltInZoomControls = true;
            Control.Settings.DisplayZoomControls = false;

            Control.Settings.LoadWithOverviewMode = true;
            Control.Settings.UseWideViewPort = true;
        }       
    }
}
1
HybridWebView seems to be the best solution in your case!Sparsha Bhattarai

1 Answers

1
votes

You can try the following approach:

  1. Add checkbox to HTML
  2. When the user check checkbox call some JavaScript function
  3. When JavaScript function is called, call C# function (Xamarin) which will enable the user to process to the next page (or some other Xamarin side stuff)

Here is how you can call C# function from JavaScript :HybridWebView