原文链接:Border Class
Namespace:System.Windows.Controls
Assembly:PresentationFramework.dll
Draws a border, background, or both around another element.
弹出框阴影效果:
XAML代码:
<Window x:Class="PopupDemo.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">
<Grid Background="LightBlue">
<Grid Width="300" Height="300">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Content="注册" Grid.Row="2" Width="100" Height="23" HorizontalAlignment="Right" Click="Button_Click"></Button>
</Grid>
<Popup AllowsTransparency="True" Placement="Center" StaysOpen="False" x:Name="popup">
<Border Background="White" CornerRadius="20" Margin="20">
<Border.Effect>
<DropShadowEffect BlurRadius="15" Direction="-90" RenderingBias="Quality" ShadowDepth="2"/>
</Border.Effect>
<Grid Width="300" Height="300">
<Button Content="弹窗测试" Grid.Row="2" Width="100" Height="23"></Button>
</Grid>
</Border>
</Popup>
</Grid>
</Window>
效果图:
备注:
必须有这两个才能显示出该效果。