问题描述
我想要一个没有按钮、带有圆角和阴影的窗口。 像这样:
这是我的 XAML 代码:
<Window x:Class="Password.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Password"
mc:Ignorable="d"
Title="MainWindow" Height="294" Width="546" Background="Transparent" Foreground="#FFE755DD" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterScreen">
<Grid >
<Grid.Effect>
<DropShadowEffect BlurRadius="20" Direction="-90" RenderingBias="Quality" ShadowDepth="2"/>
</Grid.Effect>
<Border Background="#FF22173C" CornerRadius="20,20,20"/>
</Grid>
</Window>
这是输出:
阴影不是圆形的。 我该怎么办?
解决方法
模糊被裁剪,因为您的窗口不拥有它周围的空间。
设置 <Grid Margin="20">
以允许在您控制的区域发生模糊。