WPF DropShadowEffect with allowsTransparency ="True"

GTD*_*GTD 1 wpf styles dropshadow

我想在上面创建非矩形窗口DropShadowEffect.我发现这篇文章是怎么做到的.但DropShadowEffect运行此代码时未显示.在屏幕截图中,您可以看到它DropShadowEffect存在,但它不适合我.

我怎么可以使用DropShadowEffectAllowsTransparency设置为TRUE?

Tib*_*Ana 7

我刚刚在Kaxaml中尝试了以下代码,并得到了一个带阴影的圆角框.

带投影的圆形框

我建议您也尝试使用Kaxaml,只是为了将您的实验与您可能拥有的其他代码分开.如果此确切代码显示阴影,则问题必须与您的系统有关.

<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>
Run Code Online (Sandbox Code Playgroud)