I have a window with these values:
WindowState="Maximized"
AllowsTransparency="True"
Opacity="0.5"
WindowStyle="None"
This window is coming on top of other window (as a pop-up) with content on it on a specific location.
I have a new requirement. This window have to show a rectangle area from the window below. In other words, i have to set a "hole" in this window which will be totally transparent (without the opacity value). Until this moment i couldn't figure out a way to make this transparent hole.
Hope to get an idea...
I found a kind of solution for it:
this is the pop-up window that on top of another window, and containing a hole to the other window in a desired place:
Window's header:
WindowState="Maximized"
AllowsTransparency="True"
WindowStyle="None"
Window's content:
<Window.Background >
<SolidColorBrush x:Name="BackgroundBrush" Color="WhiteSmoke" Opacity="0" ></SolidColorBrush>
</Window.Background>
<Canvas x:Name="ContectHolder" >
<Path Stroke="Black" Fill="WhiteSmoke" Opacity="0.8">
<Path.Data>
<CombinedGeometry GeometryCombineMode="Exclude">
<CombinedGeometry.Geometry1 >
<RectangleGeometry Rect="0,0,2000,2000" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<RectangleGeometry Rect="75,75,400,900" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
</Canvas>
try to avoid AllowsTransparency=true, it is very buggy and slow.
you can PInvoke SetWindowRgn to create a a window of any shape:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With