WPF阴影样式
Posted wangyinlon
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WPF阴影样式相关的知识,希望对你有一定的参考价值。
窗体阴影效果图
<!--窗体阴影开始--> <Style x:Key="for_noresize_window2" TargetType="{x:Type Window}"> <Setter Property="AllowsTransparency" Value="true"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="ResizeMode" Value="NoResize"/> <Setter Property="WindowStyle" Value="None"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Window}"> <Grid Margin="10"> <Rectangle Fill="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" RadiusX="10" RadiusY="10"> <Rectangle.Effect> <DropShadowEffect BlurRadius="10" ShadowDepth="0" Opacity="0.5"/> </Rectangle.Effect> </Rectangle> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Margin}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" CornerRadius="10"> <ContentPresenter /> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <!--窗体阴影结束-->
以上是关于WPF阴影样式的主要内容,如果未能解决你的问题,请参考以下文章