利用Board控件制造漂浮影子效果
代码如下:
View Code
<Window x:Class="WpfTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Border CornerRadius="10" BorderBrush="Gray" BorderThickness="3" Background="{x:Null}" Padding="4">
<Border.Effect>
<DropShadowEffect Color="#FFA0A0A0" Opacity=".50" ShadowDepth="16"/>
</Border.Effect>
<Grid>
<Button Content="Button" Height="23" Name="button1" Width="75" Margin="117,90,297,184" />
<Button Content="Button" Height="23" Margin="305,91,109,183" Name="button2" Width="75" />
<TextBlock HorizontalAlignment="Left" Margin="81,180,0,0" Name="textBlock1" Text="利用Board制造控件的影子效果" VerticalAlignment="Top" FontSize="24" Foreground="#FF58A830" />
</Grid>
</Border>
</Window>
实际效果如图: