How to Use Transparency in Webview2?

How to Use Transparency in Webview2?

On C#, how to use transparency in Webview2? Is it possible?

Does it work in WebBrowser but not WebView2?

1 Answer

You can change the WebView2.DefaultBackgroundColor (which defaults to white) to transparent to have a transparent background:

webView2.DefaultBackgroundColor = System.Drawing.Color.Transparent;

The WebView2 WPF sample app demonstrates this feature.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.