Hello,
Welcome to our Microsoft Q&A platform!
In old UIWebView you could set ScalesPageToFit, but new WkWebViewRenderer doesn't have this property.
Try using the following code to make the webView to fit the screen in the custom WkWebViewRenderer class.
public class CustomWebViewRenderer : WkWebViewRenderer
{
const string JavaScriptFunction = ...;
WKUserContentController userController;
public CustomWebViewRenderer() : this(new WKWebViewConfiguration())
{
}
public CustomWebViewRenderer(WKWebViewConfiguration config) : base(config)
{
userController = config.UserContentController;
var script = new WKUserScript(new NSString(JavaScriptFunction), WKUserScriptInjectionTime.AtDocumentEnd, false);
userController.AddUserScript(script);
config.UserContentController = userController;
WKWebView webView = new WKWebView(Frame, config);
}
}
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.