Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Transparent background support for WebView2? #2992

Closed
Gunners6522 opened this issue Jul 27, 2020 · 4 comments
Closed

Question: Transparent background support for WebView2? #2992

Gunners6522 opened this issue Jul 27, 2020 · 4 comments
Labels
area-WebView product-winui3 WinUI 3 issues question team-Rendering Issue for the Rendering team

Comments

@Gunners6522
Copy link

When working with UWP apps it is possible for a WebView to set "DefaultBackgroundColor='Transparent'" and receive a WebView with a transparent background. However, in WinUI3 the WebView2 component does not have this property.

So I'm wondering if the WinUI3 WebView2 component supports having a transparent background or if it is something Microsoft will eventually support? And will it then work for both WinUI3 UWP Apps and WinUI3 Desktop Apps?

This question might be related to other issues, but I wasn't sure and couldn't find a post discussing background transparency in WebView2.

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Jul 27, 2020
@Gunners6522 Gunners6522 changed the title Question: [Transparent background support for WebView2?] Question: Transparent background support for WebView2? Jul 27, 2020
@StephenLPeters StephenLPeters added area-WebView team-Controls Issue for the Controls team labels Jul 27, 2020
@StephenLPeters
Copy link
Contributor

@adambarlow FYI

@StephenLPeters StephenLPeters added product-winui3 WinUI 3 issues team-Rendering Issue for the Rendering team and removed needs-triage Issue needs to be triaged by the area owners team-Controls Issue for the Controls team labels Jul 27, 2020
@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Jul 27, 2020
@codendone
Copy link
Contributor

This may be something we eventually support, but it will not be supported in WinUI 3.

The rendering integration we can currently achieve does not allow a transparent background to properly show rendering from other WinUI elements beneath the WebView2. We'd like to change how this works in the future, which would also allow for transparency, but this will require significant changes in both the Edge WebView2 code and the WinUI code.

@darkguy2008
Copy link

darkguy2008 commented Jan 8, 2021

Just maybe a far-fetched idea, but would it be possible to override WebView2's OnPaint() method (if it has any?) and take the WebView2's resulting image and paint a color key (like Chroma key works) with a transparent color or something that Windows sees as transparent? Somewhat like Win98, WinXP and so on managed transparent windows in game installers, WinAmp and so on?

Yeah I know I'm talking about WinForms, don't like WPF very much, but maybe it's an idea.

Or, another idea: Render WebView2 in a hidden form offscreen to a form that receives that image, puts it into a PictureBox or the form's background and then apply the color key method above?

@sylveon
Copy link
Contributor

sylveon commented Jan 26, 2023

Color keys ruin text antialiasing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-WebView product-winui3 WinUI 3 issues question team-Rendering Issue for the Rendering team
Projects
None yet
Development

No branches or pull requests

6 participants