When I add a dropshadow bitmap effect to a rectangle, the dropshadow takes into account the transparency of the rectangle (makes sense). Is there a way to render a dropshadow on a transparent rectangle ‘as if’ the rectangle were opaque? ie what would appear is a rectangle-shaped ‘hole’, with a dropshadow.
Here is the XAML for a transparent rectangle with a dropshadow – nothing is displayed:
<Rectangle Fill="Transparent" Margin="10" Width="100" Height="100">
<Rectangle.BitmapEffect>
<DropShadowBitmapEffect/>
</Rectangle.BitmapEffect>
</Rectangle>
Drop this into Kaxaml. It creates a transparent Rectangle of size 500×500, with a SystemDropShadowChrome Decorator. The drop shadow’s clip is set to exclude the Rectangle’s region.
If you want your drop shadow to have rounded corners, then set the
CornerRadiusof theSystemDropShadowChrometo whatever (let’s say 10), thenGeometry1‘sLeftandTopvalues to 10, then theRadiusXandRadiusYof eachRectangleGeometryto 10.