首页 > 解决方案 > WPF窗口角半径和阴影

问题描述

我想要一个没有按钮、圆角和阴影的窗口。像这样: 像这样

所以这是我的 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, 20"/>
    </Grid>
</Window>

这是输出:

这是输出

阴影不圆。我应该怎么办?

标签: wpfui-design

解决方案


模糊被裁剪,因为您的窗口不拥有它周围的空间。

设置<Grid Margin="20">为允许在您控制的区域发生模糊。


推荐阅读