WPF Border Rectangle等效果的xaml总结
1. Inner shadow内阴影,用2个Border, 外面的Border设置ClipToBounds为True, 不用担心里面的图片会跑道Border外面。如果只想设置某条边框内阴影,只要调里面Border的BorderThickness。
<Border ClipToBounds="True" Width=" 50" Height="50" BorderBrush="RosyBrown" BorderThickness="1"> <Border BorderBrush="Black" BorderThickness="1" Margin="-2" > <Border.Effect> <DropShadowEffect BlurRadius="10" ShadowDepth="0" /> </Border.Effect> </Border> </Border>
效果如图:
2. Path
<Path Grid.Row="0" Stroke="Black" StrokeThickness="1" Fill="Blue" > <Path.Data> <GeometryGroup > <RectangleGeometry Rect="10,10, 15, 8"/> <RectangleGeometry Rect="12,12, 11, 4"/> </GeometryGroup> </Path.Data> </Path>