<Style x:Key="WindowStyle1" TargetType="{x:Type Window}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Window}"> <Grid> <Border BorderThickness="1" BorderBrush="Silver" Margin="0"> <Border.Effect> <DropShadowEffect ShadowDepth="0" BlurRadius="5" Color="Black"/> </Border.Effect> <ContentPresenter/> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
把这段代码帖到window得Resources下面,最后在window上面运用这个样式Style="{DynamicResource WindowStyle1}"
标签:Style,阴影,window,DynamicResource,WPF,WindowStyle1 From: https://www.cnblogs.com/lvpp13/p/18087606