WebView disable scrollbars

1.5k Views Asked by At

Why can't I disable WebView's scrollbars? This is my code

<WebView x:Name="Browser" Source="https://m.investing.com/economic-calendar/" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"/>

No scrollbars are disabled. Any ideas how to disable the vertical scroll bars. The goal is to wrap the WebView in a ScrollViewer and use ScrollViewer's scroll bars instead.

1

There are 1 best solutions below

1
John P. On

Solution here:

private static string[] SetBodyOverFlowHiddenString = new string[] { @"function SetBodyOverFlowHidden() { document.body.style.overflow = 'hidden'; } SetBodyOverFlowHidden();" };
    private async void Browser_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
    {
        await Browser.InvokeScriptAsync("eval", SetBodyOverFlowHiddenString);
        Debug.WriteLine("Loaded");
    }