question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Window Transparency support

See original GitHub issue

It’d be nice to see support for window transparency which will allow us to draw our own desktop overlay. Currently we are able to do just that in WPF by declaring the following properties on a Window <Window WindowStyle="None" AllowsTransparency="True" Background="Transparent" /> however if we were to implement WindowsXAMLHost in a WPF application to host modern controls, it is currently not supported with the transparent regions showing through as black. We should just truly embrace support for Window transparency by adding support for it in WinUI for the desktop.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
weltkantecommented, May 21, 2020

While this might have been true in olden times when transparency was just overpainting, these days composition is out of process by a separate compositor, so I don’t think capturing a windows content will reveal underlying windows if the compositor doesn’t want to go out of its way to implement that. Also the legacy GDI transparency is still supported, just expensive and awkward to use with modern DirectX/Composition rendering because you have to loop GPU resources back to CPU through GDI every frame just to have desktop composition reupload to GPU.

[edit] on a side note regarding security, theres the option of marking a window to be excluded from composition readback via SetWindowDisplayAffinity so the compositor is already able to recognize content that should not be copied.

1reaction
mdtaukcommented, May 21, 2020

Using legacy GDI is not necessary. UWP uses DirectX and DirectComposition under the hood for complete rendering anyways, along with the DWM. That being said, certain features like background acrylic are possible because of DirectComposition. A brush returned from CreateHostBackdropBrush() is just part of the transparent swapchain that DirectComposition uses with a gaussian blur applied to it.

AllowTransparency is very much possible, it seems like the CompositionBackdropBrush should be preconfigured to exclude a gaussian blur by default, so creating a truly transparent window can be possible.

HostBackdrop is one of those features that is disabled in WinUI 3.0 right now, as the team tries to find a way to implement it once decoupled from the OS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window transparency in Windows 11 - Microsoft Q&A
Hi, I had a working example on windows 8 of a transparent window, I don't remember exactly if it used UpdateLayeredWindow or AlphaBlend, ......
Read more >
Is window opacity for Mono forms supported?
Mono's Winform implementation supports transparency on its windows as long as the underlying windowing system has support for it. For Unix/X11 ...
Read more >
Setting the Transparency for Floating Windows
To specify the transparency value, select File > Preferences > Global, and select the Display tab. In the Tool Windows section, specify the...
Read more >
Transparent window possible with integrated graphics only
I wanted to get transparency working because it's a major part of my project. I made the clear color alpha value 0.0, ...
Read more >
How to turn off transparency in Windows 10
Open the Ease of Access settings by pressing the Windows logo key + U. Alternatively, select the Start Menu, then Settings, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found