Border 基本使用
1单线效果
代码:
BorderThickness="0,0,0,1" BorderBrush="Red" />
说明:
BorderThickness="0,0,0,1" 可以分别设置四条边,顺序是:左 上 右 下
2虚线效果
代码:
- <Border Grid.Row="0" BorderThickness="0,0,0,1" >
- <Border.BorderBrush>
- <VisualBrush>
- <VisualBrush.Visual>
- <Rectangle StrokeDashArray="4 2" Stroke="Gray" StrokeThickness="1"
- Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
- Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
- </VisualBrush.Visual>
- </VisualBrush>
- </Border.BorderBrush>
- </Border>
BorderThickness="1" 只设置一个值时表示4条边都是一样的大小