Hello,
After testing, scrollbars in Windows WebView are actually controlled internally by web pages, so you could inject JavaScript code into the webpage to hide it.
Please refer to the following code:
// in xaml
<WebView x:Name="test_web" WidthRequest="500" HeightRequest="600" Source="https://www.microsoft.com/"></WebView>
// in code-behind
protected override void OnHandlerChanged()
{
base.OnHandlerChanged();
#if WINDOWS
var webview = test_web.Handler.PlatformView as WebView2;
webview.CoreWebView2Initialized += (sender, args) =>
{
if (sender.CoreWebView2 != null)
{
sender.CoreWebView2.DOMContentLoaded += (s, a) =>
{
sender.ExecuteScriptAsync("document.querySelector('body').style.overflow='scroll';var style=document.createElement('style');style.type='text/css';style.innerHTML='::-webkit-scrollbar{display:none}';document.getElementsByTagName('body')[0].appendChild(style)");
};
}
};
#endif
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.