wpf - 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>
这是输出:
阴影不圆。我应该怎么办?
解决方案
模糊被裁剪,因为您的窗口不拥有它周围的空间。
设置<Grid Margin="20">
为允许在您控制的区域发生模糊。
推荐阅读
- python - 在 nlp 中训练数据以使用 LSTM 提取技能,但训练和验证准确性不如预期
- swift - SwiftUI:使用 HDR/EDR 来增加形状亮度?
- javascript - 为什么我通过加法和乘法得到不同的数字?
- laravel-8 - 传递给 App\Models\User::hasAnyRoles() 的参数 1 必须是数组类型,给定字符串
- flutter - 小部件库捕获的异常═在 null 上调用了方法“+”。接收者:null 尝试调用:+(" ")
- apache-spark - Pyspark 中数组元素上的 UDF 还添加了静态元素
- python - 如何将类型的字符串表示形式转换回 Python 中的类型实例?
- ruby-on-rails - 如果函数调用返回某些内容,Ruby/Rails 将返回结果
- c# - EF Core - 保存更改不会添加新记录
- python - os.environ 在 pyinstaller 之后找不到实际的文件路径