In WinUI 3, is it possible to create a transparent Xaml Island overlay on top of parent hwnd?
See original GitHub issueI have created a Xaml Island in a C++ Desktop Application:
xaml_app_host_ = winrt::Microsoft::UI::Xaml::Application{};
desktop_window_xaml_source_ = winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource{};
desktop_window_xaml_source_.as<IDesktopWindowXamlSourceNative>()->AttachToWindow(window_);
I see the window created and the child corewindow and bridge window children under my main window:
Controls render fine, but the entire window turns black, covering contents rendered to the parent window. I would like the controls in the xaml island to show up overlaid on the contents rendered to the parent window (which is rendering at low latency and controlling the message pump).
This behavior happens even without any controls set to the content.
I have tried futzing with setting ws_ex_layered, and a COLORKEY:
auto content_bridge = FindWindowEx(window_, NULL, L"Microsoft.UI.Input.DesktopWindowLiftedContentBridge", NULL);
::SetWindowLong(content_bridge, GWL_EXSTYLE, GetWindowLong(content_bridge, GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TRANSPARENT);
::SetLayeredWindowAttributes(content_bridge, RGB(0,0,0), 0, LWA_COLORKEY);
Is this possible? If not, are there any work arounds?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Need help to make window as overlay in WinUI3 ...
I have created WinUI3 project to make a overlay application show it on top of every other application. I need below things to...
Read more >Host WinRT XAML controls in desktop apps (XAML Islands)
Starting in Windows 10, version 1903, you can host WinRT XAML controls in non-UWP desktop applications using a feature called XAML Islands.
Read more >Maui -- How to make the background color transparent?
In WinUI 3, is it possible to create a transparent Xaml Island overlay on top of parent hwnd? #2956 · Share.
Read more >A deep-dive into WinUI 3 in desktop apps - Windows Blog
A deep-dive into WinUI 3 in desktop apps ... XAML Islands was our first solution to enable developers to use UWP XAML inside...
Read more >Untitled
Wpf transparent overlay window WPF Window with transparent background ... In WinUI 3, is it possible to create a transparent Xaml Island overlay...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi is there any update on adding transparency to WinUI 3?
Hi,
I am new to UWP and WinUI 3.
I am currently working to make Transparent overlay and click through. Is it possible to achieve these functionalities using UWP(C#) or WinUI 3 in UWP (C#); without using win32 api dlls?
I have achieved transparency and click through with win32 api’s. But I need to know the possibilities other than win32 api’s .