Wpf 阴影消失。以下是如何重现。
在 xaml 垫中键入以下内容。
<Page.Resources>
<DropShadowEffect x:Key="shadow"
Opacity="1"
ShadowDepth="1"
Color="Blue"
BlurRadius="30"/>
</Page.Resources>
<Grid>
<Button HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Bd"
BorderBrush="Black" BorderThickness="1"
Background="Yellow"
CornerRadius="8"
Effect="{StaticResource shadow}">
<TextBlock Text="Hello out there" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
</Grid>
您应该会看到一些带有边框的文本,并且在边框周围有一个阴影。
现在将Margin="0,0,0,0"更改为Margin="0,300,0,0",并调整您的 xaml pad 窗口大小,以便您可以看到边框。在我的机器上,阴影现在消失了。
还有人看到这个吗?请帮忙。