WPF创建一个凹凸效果的边框
样式如下:
<Style x:Key="BorderStyle" TargetType="Border"> <Setter Property="BorderBrush" Value="#55020403" /> <Setter Property="BorderThickness" Value="2" /> <Setter Property="CornerRadius" Value="5" /> <Setter Property="Effect"> <Setter.Value> <DropShadowEffect BlurRadius="2" Opacity="0.3" ShadowDepth="2" Color="White" /> </Setter.Value> </Setter> </Style>
xmal代码如下:
<Border Grid.Column="1" Width="200" Height="100" Style="{StaticResource BorderStyle}"> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="36" Foreground="#FF45C4EF" Text="10:00:00" /> </Border>
看起来的效果: