WPF - 元素不可见但具有阴影效果

WPF - Element is invisible but has dropshadow effect

我需要一种效果,我的元素 不可见 但它们实际上 有阴影 。是否可以这样做,如果可以,怎么做?

编辑: 如果这是不可能的,我可以将我的元素(图像和标签)用作 masks 所以只有阴影是可见的。我正在追求一些剪影效果。

另一个编辑:

这是按钮本身:

    <Button x:Name="login_button" Grid.Row="1" Grid.Column="1" Template="{DynamicResource TileTemplate}"
             Margin="5,10,5,10">
        <Grid>
            <Grid.Effect>
                <DropShadowEffect BlurRadius="0" 
                                  Color="{Binding ElementName=login_button, Path=BorderBrush.Color,UpdateSourceTrigger=PropertyChanged}"
                                  Opacity="{Binding ElementName=login_button, Path=BorderBrush.Opacity,UpdateSourceTrigger=PropertyChanged}"
                                  Direction="0" ShadowDepth="0">
                </DropShadowEffect>
            </Grid.Effect>
            <Grid.RowDefinitions>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="4*"/>
            </Grid.RowDefinitions>
            <Image Source="pack://application:,,,/textures/logos/lock.png"
                   VerticalAlignment="Stretch" HorizontalAlignment="Left" Grid.Row="0"
                   Margin="10,10,10,10" Visibility="Visible" OpacityMask="White">
            </Image>
            <Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Bottom"
                   HorizontalContentAlignment="Left" VerticalContentAlignment="Bottom"
                   Content="LOG IN" FontSize="40" FontFamily="CenturyGothicRegual"
                   Margin="10,10,10,10">
                <!--<Label.Foreground>
                    <SolidColorBrush Color="{Binding ElementName=login_button, Path=BorderBrush.Color,UpdateSourceTrigger=PropertyChanged}"
                                     Opacity="{Binding ElementName=login_button, Path=BorderBrush.Opacity,UpdateSourceTrigger=PropertyChanged}"/>
                </Label.Foreground>-->
                <Label.Style>
                    <Style TargetType="Label">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Button}}" Value="True">
                                <Setter Property="Foreground">
                                    <Setter.Value>
                                        <SolidColorBrush Color="#FFD1A139" />
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Opacity" Value="0.8" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding IsPressed, RelativeSource={RelativeSource AncestorType=Button}}" Value="True">
                                <Setter Property="Foreground">
                                    <Setter.Value>
                                        <SolidColorBrush Color="#FFF0A300" />
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Opacity" Value="0.8" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Label.Style>
            </Label>
        </Grid>
    </Button>

因此 恰好在元素下方应用了阴影效果 并且计划是只有刺眼的阴影可见。我的目的是用它来避免图像着色(和导入各种图像)。

当时我找到了一个解决方案,Visual StudioBlend 有一个很好的路径和形状功能。如果您绘制一条路径并将其合并,它将与分辨率无关并且非常适合我所追求的轮廓效果。