I want to create Non-Rectangular Window with DropShadowEffect
on it. I found this article how to do this. However DropShadowEffect
is not shown when running this code. On screenshots you can see that DropShadowEffect
is present, but it's not working for me.
How I can use DropShadowEffect
with AllowsTransparency
set to True?
I just tried the following code in Kaxaml and got a rounded box with a drop shadow.
I suggest you try Kaxaml too, just to separate your experiments from whatever other code you might have. If this exact code does not show a drop shadow, then the problem must be with your system.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
>
<Border CornerRadius="10"
BorderBrush="Gray"
BorderThickness="3"
Background="AliceBlue"
Margin="24"
Padding="4"
Width="100"
Height="100"
>
<Border.Effect>
<DropShadowEffect Color="Gray"
Opacity=".50"
ShadowDepth="16" />
</Border.Effect>
<Grid Background="AliceBlue">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Hello world.</TextBlock>
</Grid>
</Border>
</Window>