First of all this might feel as a stupid Question (You could have loaded WPF content directly in a WPF window), but actually read the full description to know why I need this.
I am developing a C# WPF Application to Emulate Windows Acrylic Blur Effect. I am using sample code from here: Win32 Composition Samples .
With this code I was able to create the acrylic blur on an HwndHost
or Directly on the Window. But this causes the Windows Aerospace Issue which means all the controls I draw on the window will appear under the AcrylicBlur (Blurred). Like this one:
Acrylic Content Overlapping My WPF Button
So I decided to create a window with acrylic effect and create a HwndHost
as the child of that window so that I could overlap the WPF Content on top of the Acrylic Blur so that the WPF Controls Won't Get Blurred Out.
There is One more Concept that I can try out, is to create two windows one with the acrylic and one with the WPF and share there WM_POSITIONCHANGED
Message for both window which cause the windows to move and resize equally. But this have several issues.
Find a way to Host WPF Page, instead of using HwndHost i used HwndSource.
HwndSourceParameters param = new HwndSourceParameters("Host");
param.PositionX = 10;
param.PositionY = 10;
param.Width = 500;
param.Height = 500;
param.ExtendedWindowStyle +=0x00200000; //This style creates a transparent window
param.WindowStyle = 0x10000000;
HwndSource src = new HwndSource(param);
src.SizeToContent = SizeToContent.WidthAndHeight;
src.CompositionTarget.BackgroundColor = Colors.Transparent;
src.RootVisual = new Page1(); //Your Page Here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.